Skip to main content

google_cloud_translation_v3/
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_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// An Adaptive MT Dataset.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct AdaptiveMtDataset {
44    /// Required. The resource name of the dataset, in form of
45    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
46    pub name: std::string::String,
47
48    /// The name of the dataset to show in the interface. The name can be
49    /// up to 32 characters long and can consist only of ASCII Latin letters A-Z
50    /// and a-z, underscores (_), and ASCII digits 0-9.
51    pub display_name: std::string::String,
52
53    /// The BCP-47 language code of the source language.
54    pub source_language_code: std::string::String,
55
56    /// The BCP-47 language code of the target language.
57    pub target_language_code: std::string::String,
58
59    /// The number of examples in the dataset.
60    pub example_count: i32,
61
62    /// Output only. Timestamp when this dataset was created.
63    pub create_time: std::option::Option<wkt::Timestamp>,
64
65    /// Output only. Timestamp when this dataset was last updated.
66    pub update_time: std::option::Option<wkt::Timestamp>,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl AdaptiveMtDataset {
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [name][crate::model::AdaptiveMtDataset::name].
77    ///
78    /// # Example
79    /// ```ignore,no_run
80    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
81    /// let x = AdaptiveMtDataset::new().set_name("example");
82    /// ```
83    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.name = v.into();
85        self
86    }
87
88    /// Sets the value of [display_name][crate::model::AdaptiveMtDataset::display_name].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
93    /// let x = AdaptiveMtDataset::new().set_display_name("example");
94    /// ```
95    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96        self.display_name = v.into();
97        self
98    }
99
100    /// Sets the value of [source_language_code][crate::model::AdaptiveMtDataset::source_language_code].
101    ///
102    /// # Example
103    /// ```ignore,no_run
104    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
105    /// let x = AdaptiveMtDataset::new().set_source_language_code("example");
106    /// ```
107    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
108        mut self,
109        v: T,
110    ) -> Self {
111        self.source_language_code = v.into();
112        self
113    }
114
115    /// Sets the value of [target_language_code][crate::model::AdaptiveMtDataset::target_language_code].
116    ///
117    /// # Example
118    /// ```ignore,no_run
119    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
120    /// let x = AdaptiveMtDataset::new().set_target_language_code("example");
121    /// ```
122    pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
123        mut self,
124        v: T,
125    ) -> Self {
126        self.target_language_code = v.into();
127        self
128    }
129
130    /// Sets the value of [example_count][crate::model::AdaptiveMtDataset::example_count].
131    ///
132    /// # Example
133    /// ```ignore,no_run
134    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
135    /// let x = AdaptiveMtDataset::new().set_example_count(42);
136    /// ```
137    pub fn set_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
138        self.example_count = v.into();
139        self
140    }
141
142    /// Sets the value of [create_time][crate::model::AdaptiveMtDataset::create_time].
143    ///
144    /// # Example
145    /// ```ignore,no_run
146    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
147    /// use wkt::Timestamp;
148    /// let x = AdaptiveMtDataset::new().set_create_time(Timestamp::default()/* use setters */);
149    /// ```
150    pub fn set_create_time<T>(mut self, v: T) -> Self
151    where
152        T: std::convert::Into<wkt::Timestamp>,
153    {
154        self.create_time = std::option::Option::Some(v.into());
155        self
156    }
157
158    /// Sets or clears the value of [create_time][crate::model::AdaptiveMtDataset::create_time].
159    ///
160    /// # Example
161    /// ```ignore,no_run
162    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
163    /// use wkt::Timestamp;
164    /// let x = AdaptiveMtDataset::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
165    /// let x = AdaptiveMtDataset::new().set_or_clear_create_time(None::<Timestamp>);
166    /// ```
167    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
168    where
169        T: std::convert::Into<wkt::Timestamp>,
170    {
171        self.create_time = v.map(|x| x.into());
172        self
173    }
174
175    /// Sets the value of [update_time][crate::model::AdaptiveMtDataset::update_time].
176    ///
177    /// # Example
178    /// ```ignore,no_run
179    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
180    /// use wkt::Timestamp;
181    /// let x = AdaptiveMtDataset::new().set_update_time(Timestamp::default()/* use setters */);
182    /// ```
183    pub fn set_update_time<T>(mut self, v: T) -> Self
184    where
185        T: std::convert::Into<wkt::Timestamp>,
186    {
187        self.update_time = std::option::Option::Some(v.into());
188        self
189    }
190
191    /// Sets or clears the value of [update_time][crate::model::AdaptiveMtDataset::update_time].
192    ///
193    /// # Example
194    /// ```ignore,no_run
195    /// # use google_cloud_translation_v3::model::AdaptiveMtDataset;
196    /// use wkt::Timestamp;
197    /// let x = AdaptiveMtDataset::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
198    /// let x = AdaptiveMtDataset::new().set_or_clear_update_time(None::<Timestamp>);
199    /// ```
200    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
201    where
202        T: std::convert::Into<wkt::Timestamp>,
203    {
204        self.update_time = v.map(|x| x.into());
205        self
206    }
207}
208
209impl wkt::message::Message for AdaptiveMtDataset {
210    fn typename() -> &'static str {
211        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtDataset"
212    }
213}
214
215///  Request message for creating an AdaptiveMtDataset.
216#[derive(Clone, Default, PartialEq)]
217#[non_exhaustive]
218pub struct CreateAdaptiveMtDatasetRequest {
219    /// Required. Name of the parent project. In form of
220    /// `projects/{project-number-or-id}/locations/{location-id}`
221    pub parent: std::string::String,
222
223    /// Required. The AdaptiveMtDataset to be created.
224    pub adaptive_mt_dataset: std::option::Option<crate::model::AdaptiveMtDataset>,
225
226    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
227}
228
229impl CreateAdaptiveMtDatasetRequest {
230    pub fn new() -> Self {
231        std::default::Default::default()
232    }
233
234    /// Sets the value of [parent][crate::model::CreateAdaptiveMtDatasetRequest::parent].
235    ///
236    /// # Example
237    /// ```ignore,no_run
238    /// # use google_cloud_translation_v3::model::CreateAdaptiveMtDatasetRequest;
239    /// let x = CreateAdaptiveMtDatasetRequest::new().set_parent("example");
240    /// ```
241    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
242        self.parent = v.into();
243        self
244    }
245
246    /// Sets the value of [adaptive_mt_dataset][crate::model::CreateAdaptiveMtDatasetRequest::adaptive_mt_dataset].
247    ///
248    /// # Example
249    /// ```ignore,no_run
250    /// # use google_cloud_translation_v3::model::CreateAdaptiveMtDatasetRequest;
251    /// use google_cloud_translation_v3::model::AdaptiveMtDataset;
252    /// let x = CreateAdaptiveMtDatasetRequest::new().set_adaptive_mt_dataset(AdaptiveMtDataset::default()/* use setters */);
253    /// ```
254    pub fn set_adaptive_mt_dataset<T>(mut self, v: T) -> Self
255    where
256        T: std::convert::Into<crate::model::AdaptiveMtDataset>,
257    {
258        self.adaptive_mt_dataset = std::option::Option::Some(v.into());
259        self
260    }
261
262    /// Sets or clears the value of [adaptive_mt_dataset][crate::model::CreateAdaptiveMtDatasetRequest::adaptive_mt_dataset].
263    ///
264    /// # Example
265    /// ```ignore,no_run
266    /// # use google_cloud_translation_v3::model::CreateAdaptiveMtDatasetRequest;
267    /// use google_cloud_translation_v3::model::AdaptiveMtDataset;
268    /// let x = CreateAdaptiveMtDatasetRequest::new().set_or_clear_adaptive_mt_dataset(Some(AdaptiveMtDataset::default()/* use setters */));
269    /// let x = CreateAdaptiveMtDatasetRequest::new().set_or_clear_adaptive_mt_dataset(None::<AdaptiveMtDataset>);
270    /// ```
271    pub fn set_or_clear_adaptive_mt_dataset<T>(mut self, v: std::option::Option<T>) -> Self
272    where
273        T: std::convert::Into<crate::model::AdaptiveMtDataset>,
274    {
275        self.adaptive_mt_dataset = v.map(|x| x.into());
276        self
277    }
278}
279
280impl wkt::message::Message for CreateAdaptiveMtDatasetRequest {
281    fn typename() -> &'static str {
282        "type.googleapis.com/google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest"
283    }
284}
285
286/// Request message for deleting an AdaptiveMtDataset.
287#[derive(Clone, Default, PartialEq)]
288#[non_exhaustive]
289pub struct DeleteAdaptiveMtDatasetRequest {
290    /// Required. Name of the dataset. In the form of
291    /// `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
292    pub name: std::string::String,
293
294    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
295}
296
297impl DeleteAdaptiveMtDatasetRequest {
298    pub fn new() -> Self {
299        std::default::Default::default()
300    }
301
302    /// Sets the value of [name][crate::model::DeleteAdaptiveMtDatasetRequest::name].
303    ///
304    /// # Example
305    /// ```ignore,no_run
306    /// # use google_cloud_translation_v3::model::DeleteAdaptiveMtDatasetRequest;
307    /// let x = DeleteAdaptiveMtDatasetRequest::new().set_name("example");
308    /// ```
309    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
310        self.name = v.into();
311        self
312    }
313}
314
315impl wkt::message::Message for DeleteAdaptiveMtDatasetRequest {
316    fn typename() -> &'static str {
317        "type.googleapis.com/google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest"
318    }
319}
320
321/// Request message for getting an Adaptive MT dataset.
322#[derive(Clone, Default, PartialEq)]
323#[non_exhaustive]
324pub struct GetAdaptiveMtDatasetRequest {
325    /// Required. Name of the dataset. In the form of
326    /// `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
327    pub name: std::string::String,
328
329    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
330}
331
332impl GetAdaptiveMtDatasetRequest {
333    pub fn new() -> Self {
334        std::default::Default::default()
335    }
336
337    /// Sets the value of [name][crate::model::GetAdaptiveMtDatasetRequest::name].
338    ///
339    /// # Example
340    /// ```ignore,no_run
341    /// # use google_cloud_translation_v3::model::GetAdaptiveMtDatasetRequest;
342    /// let x = GetAdaptiveMtDatasetRequest::new().set_name("example");
343    /// ```
344    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
345        self.name = v.into();
346        self
347    }
348}
349
350impl wkt::message::Message for GetAdaptiveMtDatasetRequest {
351    fn typename() -> &'static str {
352        "type.googleapis.com/google.cloud.translation.v3.GetAdaptiveMtDatasetRequest"
353    }
354}
355
356/// Request message for listing all Adaptive MT datasets that the requestor has
357/// access to.
358#[derive(Clone, Default, PartialEq)]
359#[non_exhaustive]
360pub struct ListAdaptiveMtDatasetsRequest {
361    /// Required. The resource name of the project from which to list the Adaptive
362    /// MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
363    pub parent: std::string::String,
364
365    /// Optional. Requested page size. The server may return fewer results than
366    /// requested. If unspecified, the server picks an appropriate default.
367    pub page_size: i32,
368
369    /// Optional. A token identifying a page of results the server should return.
370    /// Typically, this is the value of
371    /// ListAdaptiveMtDatasetsResponse.next_page_token returned from the
372    /// previous call to `ListAdaptiveMtDatasets` method. The first page is
373    /// returned if `page_token`is empty or missing.
374    pub page_token: std::string::String,
375
376    /// Optional. An expression for filtering the results of the request.
377    /// Filter is not supported yet.
378    pub filter: std::string::String,
379
380    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
381}
382
383impl ListAdaptiveMtDatasetsRequest {
384    pub fn new() -> Self {
385        std::default::Default::default()
386    }
387
388    /// Sets the value of [parent][crate::model::ListAdaptiveMtDatasetsRequest::parent].
389    ///
390    /// # Example
391    /// ```ignore,no_run
392    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsRequest;
393    /// let x = ListAdaptiveMtDatasetsRequest::new().set_parent("example");
394    /// ```
395    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
396        self.parent = v.into();
397        self
398    }
399
400    /// Sets the value of [page_size][crate::model::ListAdaptiveMtDatasetsRequest::page_size].
401    ///
402    /// # Example
403    /// ```ignore,no_run
404    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsRequest;
405    /// let x = ListAdaptiveMtDatasetsRequest::new().set_page_size(42);
406    /// ```
407    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
408        self.page_size = v.into();
409        self
410    }
411
412    /// Sets the value of [page_token][crate::model::ListAdaptiveMtDatasetsRequest::page_token].
413    ///
414    /// # Example
415    /// ```ignore,no_run
416    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsRequest;
417    /// let x = ListAdaptiveMtDatasetsRequest::new().set_page_token("example");
418    /// ```
419    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
420        self.page_token = v.into();
421        self
422    }
423
424    /// Sets the value of [filter][crate::model::ListAdaptiveMtDatasetsRequest::filter].
425    ///
426    /// # Example
427    /// ```ignore,no_run
428    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsRequest;
429    /// let x = ListAdaptiveMtDatasetsRequest::new().set_filter("example");
430    /// ```
431    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
432        self.filter = v.into();
433        self
434    }
435}
436
437impl wkt::message::Message for ListAdaptiveMtDatasetsRequest {
438    fn typename() -> &'static str {
439        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest"
440    }
441}
442
443/// A list of AdaptiveMtDatasets.
444#[derive(Clone, Default, PartialEq)]
445#[non_exhaustive]
446pub struct ListAdaptiveMtDatasetsResponse {
447    /// Output only. A list of Adaptive MT datasets.
448    pub adaptive_mt_datasets: std::vec::Vec<crate::model::AdaptiveMtDataset>,
449
450    /// Optional. A token to retrieve a page of results. Pass this value in the
451    /// [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
452    /// `ListAdaptiveMtDatasets` method to retrieve the next page of results.
453    pub next_page_token: std::string::String,
454
455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
456}
457
458impl ListAdaptiveMtDatasetsResponse {
459    pub fn new() -> Self {
460        std::default::Default::default()
461    }
462
463    /// Sets the value of [adaptive_mt_datasets][crate::model::ListAdaptiveMtDatasetsResponse::adaptive_mt_datasets].
464    ///
465    /// # Example
466    /// ```ignore,no_run
467    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsResponse;
468    /// use google_cloud_translation_v3::model::AdaptiveMtDataset;
469    /// let x = ListAdaptiveMtDatasetsResponse::new()
470    ///     .set_adaptive_mt_datasets([
471    ///         AdaptiveMtDataset::default()/* use setters */,
472    ///         AdaptiveMtDataset::default()/* use (different) setters */,
473    ///     ]);
474    /// ```
475    pub fn set_adaptive_mt_datasets<T, V>(mut self, v: T) -> Self
476    where
477        T: std::iter::IntoIterator<Item = V>,
478        V: std::convert::Into<crate::model::AdaptiveMtDataset>,
479    {
480        use std::iter::Iterator;
481        self.adaptive_mt_datasets = v.into_iter().map(|i| i.into()).collect();
482        self
483    }
484
485    /// Sets the value of [next_page_token][crate::model::ListAdaptiveMtDatasetsResponse::next_page_token].
486    ///
487    /// # Example
488    /// ```ignore,no_run
489    /// # use google_cloud_translation_v3::model::ListAdaptiveMtDatasetsResponse;
490    /// let x = ListAdaptiveMtDatasetsResponse::new().set_next_page_token("example");
491    /// ```
492    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
493        self.next_page_token = v.into();
494        self
495    }
496}
497
498impl wkt::message::Message for ListAdaptiveMtDatasetsResponse {
499    fn typename() -> &'static str {
500        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse"
501    }
502}
503
504#[doc(hidden)]
505impl google_cloud_gax::paginator::internal::PageableResponse for ListAdaptiveMtDatasetsResponse {
506    type PageItem = crate::model::AdaptiveMtDataset;
507
508    fn items(self) -> std::vec::Vec<Self::PageItem> {
509        self.adaptive_mt_datasets
510    }
511
512    fn next_page_token(&self) -> std::string::String {
513        use std::clone::Clone;
514        self.next_page_token.clone()
515    }
516}
517
518/// The request for sending an AdaptiveMt translation query.
519#[derive(Clone, Default, PartialEq)]
520#[non_exhaustive]
521pub struct AdaptiveMtTranslateRequest {
522    /// Required. Location to make a regional call.
523    ///
524    /// Format: `projects/{project-number-or-id}/locations/{location-id}`.
525    pub parent: std::string::String,
526
527    /// Required. The resource name for the dataset to use for adaptive MT.
528    /// `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
529    pub dataset: std::string::String,
530
531    /// Required. The content of the input in string format.
532    pub content: std::vec::Vec<std::string::String>,
533
534    /// Configuration for caller provided reference sentences.
535    pub reference_sentence_config:
536        std::option::Option<crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig>,
537
538    /// Optional. Glossary to be applied. The glossary must be
539    /// within the same region (have the same location-id) as the model, otherwise
540    /// an INVALID_ARGUMENT (400) error is returned.
541    pub glossary_config:
542        std::option::Option<crate::model::adaptive_mt_translate_request::GlossaryConfig>,
543
544    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
545}
546
547impl AdaptiveMtTranslateRequest {
548    pub fn new() -> Self {
549        std::default::Default::default()
550    }
551
552    /// Sets the value of [parent][crate::model::AdaptiveMtTranslateRequest::parent].
553    ///
554    /// # Example
555    /// ```ignore,no_run
556    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
557    /// let x = AdaptiveMtTranslateRequest::new().set_parent("example");
558    /// ```
559    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
560        self.parent = v.into();
561        self
562    }
563
564    /// Sets the value of [dataset][crate::model::AdaptiveMtTranslateRequest::dataset].
565    ///
566    /// # Example
567    /// ```ignore,no_run
568    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
569    /// let x = AdaptiveMtTranslateRequest::new().set_dataset("example");
570    /// ```
571    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
572        self.dataset = v.into();
573        self
574    }
575
576    /// Sets the value of [content][crate::model::AdaptiveMtTranslateRequest::content].
577    ///
578    /// # Example
579    /// ```ignore,no_run
580    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
581    /// let x = AdaptiveMtTranslateRequest::new().set_content(["a", "b", "c"]);
582    /// ```
583    pub fn set_content<T, V>(mut self, v: T) -> Self
584    where
585        T: std::iter::IntoIterator<Item = V>,
586        V: std::convert::Into<std::string::String>,
587    {
588        use std::iter::Iterator;
589        self.content = v.into_iter().map(|i| i.into()).collect();
590        self
591    }
592
593    /// Sets the value of [reference_sentence_config][crate::model::AdaptiveMtTranslateRequest::reference_sentence_config].
594    ///
595    /// # Example
596    /// ```ignore,no_run
597    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
598    /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentenceConfig;
599    /// let x = AdaptiveMtTranslateRequest::new().set_reference_sentence_config(ReferenceSentenceConfig::default()/* use setters */);
600    /// ```
601    pub fn set_reference_sentence_config<T>(mut self, v: T) -> Self
602    where
603        T: std::convert::Into<crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig>,
604    {
605        self.reference_sentence_config = std::option::Option::Some(v.into());
606        self
607    }
608
609    /// Sets or clears the value of [reference_sentence_config][crate::model::AdaptiveMtTranslateRequest::reference_sentence_config].
610    ///
611    /// # Example
612    /// ```ignore,no_run
613    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
614    /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentenceConfig;
615    /// let x = AdaptiveMtTranslateRequest::new().set_or_clear_reference_sentence_config(Some(ReferenceSentenceConfig::default()/* use setters */));
616    /// let x = AdaptiveMtTranslateRequest::new().set_or_clear_reference_sentence_config(None::<ReferenceSentenceConfig>);
617    /// ```
618    pub fn set_or_clear_reference_sentence_config<T>(mut self, v: std::option::Option<T>) -> Self
619    where
620        T: std::convert::Into<crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig>,
621    {
622        self.reference_sentence_config = v.map(|x| x.into());
623        self
624    }
625
626    /// Sets the value of [glossary_config][crate::model::AdaptiveMtTranslateRequest::glossary_config].
627    ///
628    /// # Example
629    /// ```ignore,no_run
630    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
631    /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::GlossaryConfig;
632    /// let x = AdaptiveMtTranslateRequest::new().set_glossary_config(GlossaryConfig::default()/* use setters */);
633    /// ```
634    pub fn set_glossary_config<T>(mut self, v: T) -> Self
635    where
636        T: std::convert::Into<crate::model::adaptive_mt_translate_request::GlossaryConfig>,
637    {
638        self.glossary_config = std::option::Option::Some(v.into());
639        self
640    }
641
642    /// Sets or clears the value of [glossary_config][crate::model::AdaptiveMtTranslateRequest::glossary_config].
643    ///
644    /// # Example
645    /// ```ignore,no_run
646    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateRequest;
647    /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::GlossaryConfig;
648    /// let x = AdaptiveMtTranslateRequest::new().set_or_clear_glossary_config(Some(GlossaryConfig::default()/* use setters */));
649    /// let x = AdaptiveMtTranslateRequest::new().set_or_clear_glossary_config(None::<GlossaryConfig>);
650    /// ```
651    pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
652    where
653        T: std::convert::Into<crate::model::adaptive_mt_translate_request::GlossaryConfig>,
654    {
655        self.glossary_config = v.map(|x| x.into());
656        self
657    }
658}
659
660impl wkt::message::Message for AdaptiveMtTranslateRequest {
661    fn typename() -> &'static str {
662        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateRequest"
663    }
664}
665
666/// Defines additional types related to [AdaptiveMtTranslateRequest].
667pub mod adaptive_mt_translate_request {
668    #[allow(unused_imports)]
669    use super::*;
670
671    /// A pair of sentences used as reference in source and target languages.
672    #[derive(Clone, Default, PartialEq)]
673    #[non_exhaustive]
674    pub struct ReferenceSentencePair {
675        /// Source sentence in the sentence pair.
676        pub source_sentence: std::string::String,
677
678        /// Target sentence in the sentence pair.
679        pub target_sentence: std::string::String,
680
681        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
682    }
683
684    impl ReferenceSentencePair {
685        pub fn new() -> Self {
686            std::default::Default::default()
687        }
688
689        /// Sets the value of [source_sentence][crate::model::adaptive_mt_translate_request::ReferenceSentencePair::source_sentence].
690        ///
691        /// # Example
692        /// ```ignore,no_run
693        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentencePair;
694        /// let x = ReferenceSentencePair::new().set_source_sentence("example");
695        /// ```
696        pub fn set_source_sentence<T: std::convert::Into<std::string::String>>(
697            mut self,
698            v: T,
699        ) -> Self {
700            self.source_sentence = v.into();
701            self
702        }
703
704        /// Sets the value of [target_sentence][crate::model::adaptive_mt_translate_request::ReferenceSentencePair::target_sentence].
705        ///
706        /// # Example
707        /// ```ignore,no_run
708        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentencePair;
709        /// let x = ReferenceSentencePair::new().set_target_sentence("example");
710        /// ```
711        pub fn set_target_sentence<T: std::convert::Into<std::string::String>>(
712            mut self,
713            v: T,
714        ) -> Self {
715            self.target_sentence = v.into();
716            self
717        }
718    }
719
720    impl wkt::message::Message for ReferenceSentencePair {
721        fn typename() -> &'static str {
722            "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair"
723        }
724    }
725
726    /// A list of reference sentence pairs.
727    #[derive(Clone, Default, PartialEq)]
728    #[non_exhaustive]
729    pub struct ReferenceSentencePairList {
730        /// Reference sentence pairs.
731        pub reference_sentence_pairs:
732            std::vec::Vec<crate::model::adaptive_mt_translate_request::ReferenceSentencePair>,
733
734        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
735    }
736
737    impl ReferenceSentencePairList {
738        pub fn new() -> Self {
739            std::default::Default::default()
740        }
741
742        /// Sets the value of [reference_sentence_pairs][crate::model::adaptive_mt_translate_request::ReferenceSentencePairList::reference_sentence_pairs].
743        ///
744        /// # Example
745        /// ```ignore,no_run
746        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentencePairList;
747        /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentencePair;
748        /// let x = ReferenceSentencePairList::new()
749        ///     .set_reference_sentence_pairs([
750        ///         ReferenceSentencePair::default()/* use setters */,
751        ///         ReferenceSentencePair::default()/* use (different) setters */,
752        ///     ]);
753        /// ```
754        pub fn set_reference_sentence_pairs<T, V>(mut self, v: T) -> Self
755        where
756            T: std::iter::IntoIterator<Item = V>,
757            V: std::convert::Into<
758                    crate::model::adaptive_mt_translate_request::ReferenceSentencePair,
759                >,
760        {
761            use std::iter::Iterator;
762            self.reference_sentence_pairs = v.into_iter().map(|i| i.into()).collect();
763            self
764        }
765    }
766
767    impl wkt::message::Message for ReferenceSentencePairList {
768        fn typename() -> &'static str {
769            "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList"
770        }
771    }
772
773    /// Message of caller-provided reference configuration.
774    #[derive(Clone, Default, PartialEq)]
775    #[non_exhaustive]
776    pub struct ReferenceSentenceConfig {
777        /// Reference sentences pair lists. Each list will be used as the references
778        /// to translate the sentence under "content" field at the corresponding
779        /// index. Length of the list is required to be equal to the length of
780        /// "content" field.
781        pub reference_sentence_pair_lists:
782            std::vec::Vec<crate::model::adaptive_mt_translate_request::ReferenceSentencePairList>,
783
784        /// Source language code.
785        pub source_language_code: std::string::String,
786
787        /// Target language code.
788        pub target_language_code: std::string::String,
789
790        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
791    }
792
793    impl ReferenceSentenceConfig {
794        pub fn new() -> Self {
795            std::default::Default::default()
796        }
797
798        /// Sets the value of [reference_sentence_pair_lists][crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig::reference_sentence_pair_lists].
799        ///
800        /// # Example
801        /// ```ignore,no_run
802        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentenceConfig;
803        /// use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentencePairList;
804        /// let x = ReferenceSentenceConfig::new()
805        ///     .set_reference_sentence_pair_lists([
806        ///         ReferenceSentencePairList::default()/* use setters */,
807        ///         ReferenceSentencePairList::default()/* use (different) setters */,
808        ///     ]);
809        /// ```
810        pub fn set_reference_sentence_pair_lists<T, V>(mut self, v: T) -> Self
811        where
812            T: std::iter::IntoIterator<Item = V>,
813            V: std::convert::Into<
814                    crate::model::adaptive_mt_translate_request::ReferenceSentencePairList,
815                >,
816        {
817            use std::iter::Iterator;
818            self.reference_sentence_pair_lists = v.into_iter().map(|i| i.into()).collect();
819            self
820        }
821
822        /// Sets the value of [source_language_code][crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig::source_language_code].
823        ///
824        /// # Example
825        /// ```ignore,no_run
826        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentenceConfig;
827        /// let x = ReferenceSentenceConfig::new().set_source_language_code("example");
828        /// ```
829        pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
830            mut self,
831            v: T,
832        ) -> Self {
833            self.source_language_code = v.into();
834            self
835        }
836
837        /// Sets the value of [target_language_code][crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig::target_language_code].
838        ///
839        /// # Example
840        /// ```ignore,no_run
841        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::ReferenceSentenceConfig;
842        /// let x = ReferenceSentenceConfig::new().set_target_language_code("example");
843        /// ```
844        pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
845            mut self,
846            v: T,
847        ) -> Self {
848            self.target_language_code = v.into();
849            self
850        }
851    }
852
853    impl wkt::message::Message for ReferenceSentenceConfig {
854        fn typename() -> &'static str {
855            "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfig"
856        }
857    }
858
859    /// Configures which glossary is used for a specific target language and
860    /// defines
861    /// options for applying that glossary.
862    #[derive(Clone, Default, PartialEq)]
863    #[non_exhaustive]
864    pub struct GlossaryConfig {
865        /// Required. The `glossary` to be applied for this translation.
866        ///
867        /// The format depends on the glossary:
868        ///
869        /// - User-provided custom glossary:
870        ///   `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
871        pub glossary: std::string::String,
872
873        /// Optional. Indicates match is case insensitive. The default value is
874        /// `false` if missing.
875        pub ignore_case: bool,
876
877        /// Optional. If set to true, the glossary will be used for contextual
878        /// translation.
879        pub contextual_translation_enabled: bool,
880
881        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
882    }
883
884    impl GlossaryConfig {
885        pub fn new() -> Self {
886            std::default::Default::default()
887        }
888
889        /// Sets the value of [glossary][crate::model::adaptive_mt_translate_request::GlossaryConfig::glossary].
890        ///
891        /// # Example
892        /// ```ignore,no_run
893        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::GlossaryConfig;
894        /// let x = GlossaryConfig::new().set_glossary("example");
895        /// ```
896        pub fn set_glossary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
897            self.glossary = v.into();
898            self
899        }
900
901        /// Sets the value of [ignore_case][crate::model::adaptive_mt_translate_request::GlossaryConfig::ignore_case].
902        ///
903        /// # Example
904        /// ```ignore,no_run
905        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::GlossaryConfig;
906        /// let x = GlossaryConfig::new().set_ignore_case(true);
907        /// ```
908        pub fn set_ignore_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
909            self.ignore_case = v.into();
910            self
911        }
912
913        /// Sets the value of [contextual_translation_enabled][crate::model::adaptive_mt_translate_request::GlossaryConfig::contextual_translation_enabled].
914        ///
915        /// # Example
916        /// ```ignore,no_run
917        /// # use google_cloud_translation_v3::model::adaptive_mt_translate_request::GlossaryConfig;
918        /// let x = GlossaryConfig::new().set_contextual_translation_enabled(true);
919        /// ```
920        pub fn set_contextual_translation_enabled<T: std::convert::Into<bool>>(
921            mut self,
922            v: T,
923        ) -> Self {
924            self.contextual_translation_enabled = v.into();
925            self
926        }
927    }
928
929    impl wkt::message::Message for GlossaryConfig {
930        fn typename() -> &'static str {
931            "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfig"
932        }
933    }
934}
935
936/// An AdaptiveMt translation.
937#[derive(Clone, Default, PartialEq)]
938#[non_exhaustive]
939pub struct AdaptiveMtTranslation {
940    /// Output only. The translated text.
941    pub translated_text: std::string::String,
942
943    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
944}
945
946impl AdaptiveMtTranslation {
947    pub fn new() -> Self {
948        std::default::Default::default()
949    }
950
951    /// Sets the value of [translated_text][crate::model::AdaptiveMtTranslation::translated_text].
952    ///
953    /// # Example
954    /// ```ignore,no_run
955    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslation;
956    /// let x = AdaptiveMtTranslation::new().set_translated_text("example");
957    /// ```
958    pub fn set_translated_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
959        self.translated_text = v.into();
960        self
961    }
962}
963
964impl wkt::message::Message for AdaptiveMtTranslation {
965    fn typename() -> &'static str {
966        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslation"
967    }
968}
969
970/// An AdaptiveMtTranslate response.
971#[derive(Clone, Default, PartialEq)]
972#[non_exhaustive]
973pub struct AdaptiveMtTranslateResponse {
974    /// Output only. The translation.
975    pub translations: std::vec::Vec<crate::model::AdaptiveMtTranslation>,
976
977    /// Output only. The translation's language code.
978    pub language_code: std::string::String,
979
980    /// Text translation response if a glossary is provided in the request. This
981    /// could be the same as 'translation' above if no terms apply.
982    pub glossary_translations: std::vec::Vec<crate::model::AdaptiveMtTranslation>,
983
984    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
985}
986
987impl AdaptiveMtTranslateResponse {
988    pub fn new() -> Self {
989        std::default::Default::default()
990    }
991
992    /// Sets the value of [translations][crate::model::AdaptiveMtTranslateResponse::translations].
993    ///
994    /// # Example
995    /// ```ignore,no_run
996    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateResponse;
997    /// use google_cloud_translation_v3::model::AdaptiveMtTranslation;
998    /// let x = AdaptiveMtTranslateResponse::new()
999    ///     .set_translations([
1000    ///         AdaptiveMtTranslation::default()/* use setters */,
1001    ///         AdaptiveMtTranslation::default()/* use (different) setters */,
1002    ///     ]);
1003    /// ```
1004    pub fn set_translations<T, V>(mut self, v: T) -> Self
1005    where
1006        T: std::iter::IntoIterator<Item = V>,
1007        V: std::convert::Into<crate::model::AdaptiveMtTranslation>,
1008    {
1009        use std::iter::Iterator;
1010        self.translations = v.into_iter().map(|i| i.into()).collect();
1011        self
1012    }
1013
1014    /// Sets the value of [language_code][crate::model::AdaptiveMtTranslateResponse::language_code].
1015    ///
1016    /// # Example
1017    /// ```ignore,no_run
1018    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateResponse;
1019    /// let x = AdaptiveMtTranslateResponse::new().set_language_code("example");
1020    /// ```
1021    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1022        self.language_code = v.into();
1023        self
1024    }
1025
1026    /// Sets the value of [glossary_translations][crate::model::AdaptiveMtTranslateResponse::glossary_translations].
1027    ///
1028    /// # Example
1029    /// ```ignore,no_run
1030    /// # use google_cloud_translation_v3::model::AdaptiveMtTranslateResponse;
1031    /// use google_cloud_translation_v3::model::AdaptiveMtTranslation;
1032    /// let x = AdaptiveMtTranslateResponse::new()
1033    ///     .set_glossary_translations([
1034    ///         AdaptiveMtTranslation::default()/* use setters */,
1035    ///         AdaptiveMtTranslation::default()/* use (different) setters */,
1036    ///     ]);
1037    /// ```
1038    pub fn set_glossary_translations<T, V>(mut self, v: T) -> Self
1039    where
1040        T: std::iter::IntoIterator<Item = V>,
1041        V: std::convert::Into<crate::model::AdaptiveMtTranslation>,
1042    {
1043        use std::iter::Iterator;
1044        self.glossary_translations = v.into_iter().map(|i| i.into()).collect();
1045        self
1046    }
1047}
1048
1049impl wkt::message::Message for AdaptiveMtTranslateResponse {
1050    fn typename() -> &'static str {
1051        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtTranslateResponse"
1052    }
1053}
1054
1055/// An AdaptiveMtFile.
1056#[derive(Clone, Default, PartialEq)]
1057#[non_exhaustive]
1058pub struct AdaptiveMtFile {
1059    /// Required. The resource name of the file, in form of
1060    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
1061    pub name: std::string::String,
1062
1063    /// The file's display name.
1064    pub display_name: std::string::String,
1065
1066    /// The number of entries that the file contains.
1067    pub entry_count: i32,
1068
1069    /// Output only. Timestamp when this file was created.
1070    pub create_time: std::option::Option<wkt::Timestamp>,
1071
1072    /// Output only. Timestamp when this file was last updated.
1073    pub update_time: std::option::Option<wkt::Timestamp>,
1074
1075    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1076}
1077
1078impl AdaptiveMtFile {
1079    pub fn new() -> Self {
1080        std::default::Default::default()
1081    }
1082
1083    /// Sets the value of [name][crate::model::AdaptiveMtFile::name].
1084    ///
1085    /// # Example
1086    /// ```ignore,no_run
1087    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1088    /// let x = AdaptiveMtFile::new().set_name("example");
1089    /// ```
1090    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1091        self.name = v.into();
1092        self
1093    }
1094
1095    /// Sets the value of [display_name][crate::model::AdaptiveMtFile::display_name].
1096    ///
1097    /// # Example
1098    /// ```ignore,no_run
1099    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1100    /// let x = AdaptiveMtFile::new().set_display_name("example");
1101    /// ```
1102    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1103        self.display_name = v.into();
1104        self
1105    }
1106
1107    /// Sets the value of [entry_count][crate::model::AdaptiveMtFile::entry_count].
1108    ///
1109    /// # Example
1110    /// ```ignore,no_run
1111    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1112    /// let x = AdaptiveMtFile::new().set_entry_count(42);
1113    /// ```
1114    pub fn set_entry_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1115        self.entry_count = v.into();
1116        self
1117    }
1118
1119    /// Sets the value of [create_time][crate::model::AdaptiveMtFile::create_time].
1120    ///
1121    /// # Example
1122    /// ```ignore,no_run
1123    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1124    /// use wkt::Timestamp;
1125    /// let x = AdaptiveMtFile::new().set_create_time(Timestamp::default()/* use setters */);
1126    /// ```
1127    pub fn set_create_time<T>(mut self, v: T) -> Self
1128    where
1129        T: std::convert::Into<wkt::Timestamp>,
1130    {
1131        self.create_time = std::option::Option::Some(v.into());
1132        self
1133    }
1134
1135    /// Sets or clears the value of [create_time][crate::model::AdaptiveMtFile::create_time].
1136    ///
1137    /// # Example
1138    /// ```ignore,no_run
1139    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1140    /// use wkt::Timestamp;
1141    /// let x = AdaptiveMtFile::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1142    /// let x = AdaptiveMtFile::new().set_or_clear_create_time(None::<Timestamp>);
1143    /// ```
1144    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1145    where
1146        T: std::convert::Into<wkt::Timestamp>,
1147    {
1148        self.create_time = v.map(|x| x.into());
1149        self
1150    }
1151
1152    /// Sets the value of [update_time][crate::model::AdaptiveMtFile::update_time].
1153    ///
1154    /// # Example
1155    /// ```ignore,no_run
1156    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1157    /// use wkt::Timestamp;
1158    /// let x = AdaptiveMtFile::new().set_update_time(Timestamp::default()/* use setters */);
1159    /// ```
1160    pub fn set_update_time<T>(mut self, v: T) -> Self
1161    where
1162        T: std::convert::Into<wkt::Timestamp>,
1163    {
1164        self.update_time = std::option::Option::Some(v.into());
1165        self
1166    }
1167
1168    /// Sets or clears the value of [update_time][crate::model::AdaptiveMtFile::update_time].
1169    ///
1170    /// # Example
1171    /// ```ignore,no_run
1172    /// # use google_cloud_translation_v3::model::AdaptiveMtFile;
1173    /// use wkt::Timestamp;
1174    /// let x = AdaptiveMtFile::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1175    /// let x = AdaptiveMtFile::new().set_or_clear_update_time(None::<Timestamp>);
1176    /// ```
1177    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1178    where
1179        T: std::convert::Into<wkt::Timestamp>,
1180    {
1181        self.update_time = v.map(|x| x.into());
1182        self
1183    }
1184}
1185
1186impl wkt::message::Message for AdaptiveMtFile {
1187    fn typename() -> &'static str {
1188        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtFile"
1189    }
1190}
1191
1192/// The request for getting an AdaptiveMtFile.
1193#[derive(Clone, Default, PartialEq)]
1194#[non_exhaustive]
1195pub struct GetAdaptiveMtFileRequest {
1196    /// Required. The resource name of the file, in form of
1197    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
1198    pub name: std::string::String,
1199
1200    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1201}
1202
1203impl GetAdaptiveMtFileRequest {
1204    pub fn new() -> Self {
1205        std::default::Default::default()
1206    }
1207
1208    /// Sets the value of [name][crate::model::GetAdaptiveMtFileRequest::name].
1209    ///
1210    /// # Example
1211    /// ```ignore,no_run
1212    /// # use google_cloud_translation_v3::model::GetAdaptiveMtFileRequest;
1213    /// let x = GetAdaptiveMtFileRequest::new().set_name("example");
1214    /// ```
1215    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1216        self.name = v.into();
1217        self
1218    }
1219}
1220
1221impl wkt::message::Message for GetAdaptiveMtFileRequest {
1222    fn typename() -> &'static str {
1223        "type.googleapis.com/google.cloud.translation.v3.GetAdaptiveMtFileRequest"
1224    }
1225}
1226
1227/// The request for deleting an AdaptiveMt file.
1228#[derive(Clone, Default, PartialEq)]
1229#[non_exhaustive]
1230pub struct DeleteAdaptiveMtFileRequest {
1231    /// Required. The resource name of the file to delete, in form of
1232    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
1233    pub name: std::string::String,
1234
1235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1236}
1237
1238impl DeleteAdaptiveMtFileRequest {
1239    pub fn new() -> Self {
1240        std::default::Default::default()
1241    }
1242
1243    /// Sets the value of [name][crate::model::DeleteAdaptiveMtFileRequest::name].
1244    ///
1245    /// # Example
1246    /// ```ignore,no_run
1247    /// # use google_cloud_translation_v3::model::DeleteAdaptiveMtFileRequest;
1248    /// let x = DeleteAdaptiveMtFileRequest::new().set_name("example");
1249    /// ```
1250    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1251        self.name = v.into();
1252        self
1253    }
1254}
1255
1256impl wkt::message::Message for DeleteAdaptiveMtFileRequest {
1257    fn typename() -> &'static str {
1258        "type.googleapis.com/google.cloud.translation.v3.DeleteAdaptiveMtFileRequest"
1259    }
1260}
1261
1262/// The request for importing an AdaptiveMt file along with its sentences.
1263#[derive(Clone, Default, PartialEq)]
1264#[non_exhaustive]
1265pub struct ImportAdaptiveMtFileRequest {
1266    /// Required. The resource name of the file, in form of
1267    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
1268    pub parent: std::string::String,
1269
1270    /// The source for the document.
1271    pub source: std::option::Option<crate::model::import_adaptive_mt_file_request::Source>,
1272
1273    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1274}
1275
1276impl ImportAdaptiveMtFileRequest {
1277    pub fn new() -> Self {
1278        std::default::Default::default()
1279    }
1280
1281    /// Sets the value of [parent][crate::model::ImportAdaptiveMtFileRequest::parent].
1282    ///
1283    /// # Example
1284    /// ```ignore,no_run
1285    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileRequest;
1286    /// let x = ImportAdaptiveMtFileRequest::new().set_parent("example");
1287    /// ```
1288    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1289        self.parent = v.into();
1290        self
1291    }
1292
1293    /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source].
1294    ///
1295    /// Note that all the setters affecting `source` are mutually
1296    /// exclusive.
1297    ///
1298    /// # Example
1299    /// ```ignore,no_run
1300    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileRequest;
1301    /// use google_cloud_translation_v3::model::FileInputSource;
1302    /// let x = ImportAdaptiveMtFileRequest::new().set_source(Some(
1303    ///     google_cloud_translation_v3::model::import_adaptive_mt_file_request::Source::FileInputSource(FileInputSource::default().into())));
1304    /// ```
1305    pub fn set_source<
1306        T: std::convert::Into<
1307                std::option::Option<crate::model::import_adaptive_mt_file_request::Source>,
1308            >,
1309    >(
1310        mut self,
1311        v: T,
1312    ) -> Self {
1313        self.source = v.into();
1314        self
1315    }
1316
1317    /// The value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
1318    /// if it holds a `FileInputSource`, `None` if the field is not set or
1319    /// holds a different branch.
1320    pub fn file_input_source(
1321        &self,
1322    ) -> std::option::Option<&std::boxed::Box<crate::model::FileInputSource>> {
1323        #[allow(unreachable_patterns)]
1324        self.source.as_ref().and_then(|v| match v {
1325            crate::model::import_adaptive_mt_file_request::Source::FileInputSource(v) => {
1326                std::option::Option::Some(v)
1327            }
1328            _ => std::option::Option::None,
1329        })
1330    }
1331
1332    /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
1333    /// to hold a `FileInputSource`.
1334    ///
1335    /// Note that all the setters affecting `source` are
1336    /// mutually exclusive.
1337    ///
1338    /// # Example
1339    /// ```ignore,no_run
1340    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileRequest;
1341    /// use google_cloud_translation_v3::model::FileInputSource;
1342    /// let x = ImportAdaptiveMtFileRequest::new().set_file_input_source(FileInputSource::default()/* use setters */);
1343    /// assert!(x.file_input_source().is_some());
1344    /// assert!(x.gcs_input_source().is_none());
1345    /// ```
1346    pub fn set_file_input_source<
1347        T: std::convert::Into<std::boxed::Box<crate::model::FileInputSource>>,
1348    >(
1349        mut self,
1350        v: T,
1351    ) -> Self {
1352        self.source = std::option::Option::Some(
1353            crate::model::import_adaptive_mt_file_request::Source::FileInputSource(v.into()),
1354        );
1355        self
1356    }
1357
1358    /// The value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
1359    /// if it holds a `GcsInputSource`, `None` if the field is not set or
1360    /// holds a different branch.
1361    pub fn gcs_input_source(
1362        &self,
1363    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsInputSource>> {
1364        #[allow(unreachable_patterns)]
1365        self.source.as_ref().and_then(|v| match v {
1366            crate::model::import_adaptive_mt_file_request::Source::GcsInputSource(v) => {
1367                std::option::Option::Some(v)
1368            }
1369            _ => std::option::Option::None,
1370        })
1371    }
1372
1373    /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
1374    /// to hold a `GcsInputSource`.
1375    ///
1376    /// Note that all the setters affecting `source` are
1377    /// mutually exclusive.
1378    ///
1379    /// # Example
1380    /// ```ignore,no_run
1381    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileRequest;
1382    /// use google_cloud_translation_v3::model::GcsInputSource;
1383    /// let x = ImportAdaptiveMtFileRequest::new().set_gcs_input_source(GcsInputSource::default()/* use setters */);
1384    /// assert!(x.gcs_input_source().is_some());
1385    /// assert!(x.file_input_source().is_none());
1386    /// ```
1387    pub fn set_gcs_input_source<
1388        T: std::convert::Into<std::boxed::Box<crate::model::GcsInputSource>>,
1389    >(
1390        mut self,
1391        v: T,
1392    ) -> Self {
1393        self.source = std::option::Option::Some(
1394            crate::model::import_adaptive_mt_file_request::Source::GcsInputSource(v.into()),
1395        );
1396        self
1397    }
1398}
1399
1400impl wkt::message::Message for ImportAdaptiveMtFileRequest {
1401    fn typename() -> &'static str {
1402        "type.googleapis.com/google.cloud.translation.v3.ImportAdaptiveMtFileRequest"
1403    }
1404}
1405
1406/// Defines additional types related to [ImportAdaptiveMtFileRequest].
1407pub mod import_adaptive_mt_file_request {
1408    #[allow(unused_imports)]
1409    use super::*;
1410
1411    /// The source for the document.
1412    #[derive(Clone, Debug, PartialEq)]
1413    #[non_exhaustive]
1414    pub enum Source {
1415        /// Inline file source.
1416        FileInputSource(std::boxed::Box<crate::model::FileInputSource>),
1417        /// Google Cloud Storage file source.
1418        GcsInputSource(std::boxed::Box<crate::model::GcsInputSource>),
1419    }
1420}
1421
1422/// The response for importing an AdaptiveMtFile
1423#[derive(Clone, Default, PartialEq)]
1424#[non_exhaustive]
1425pub struct ImportAdaptiveMtFileResponse {
1426    /// Output only. The Adaptive MT file that was imported.
1427    pub adaptive_mt_file: std::option::Option<crate::model::AdaptiveMtFile>,
1428
1429    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1430}
1431
1432impl ImportAdaptiveMtFileResponse {
1433    pub fn new() -> Self {
1434        std::default::Default::default()
1435    }
1436
1437    /// Sets the value of [adaptive_mt_file][crate::model::ImportAdaptiveMtFileResponse::adaptive_mt_file].
1438    ///
1439    /// # Example
1440    /// ```ignore,no_run
1441    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileResponse;
1442    /// use google_cloud_translation_v3::model::AdaptiveMtFile;
1443    /// let x = ImportAdaptiveMtFileResponse::new().set_adaptive_mt_file(AdaptiveMtFile::default()/* use setters */);
1444    /// ```
1445    pub fn set_adaptive_mt_file<T>(mut self, v: T) -> Self
1446    where
1447        T: std::convert::Into<crate::model::AdaptiveMtFile>,
1448    {
1449        self.adaptive_mt_file = std::option::Option::Some(v.into());
1450        self
1451    }
1452
1453    /// Sets or clears the value of [adaptive_mt_file][crate::model::ImportAdaptiveMtFileResponse::adaptive_mt_file].
1454    ///
1455    /// # Example
1456    /// ```ignore,no_run
1457    /// # use google_cloud_translation_v3::model::ImportAdaptiveMtFileResponse;
1458    /// use google_cloud_translation_v3::model::AdaptiveMtFile;
1459    /// let x = ImportAdaptiveMtFileResponse::new().set_or_clear_adaptive_mt_file(Some(AdaptiveMtFile::default()/* use setters */));
1460    /// let x = ImportAdaptiveMtFileResponse::new().set_or_clear_adaptive_mt_file(None::<AdaptiveMtFile>);
1461    /// ```
1462    pub fn set_or_clear_adaptive_mt_file<T>(mut self, v: std::option::Option<T>) -> Self
1463    where
1464        T: std::convert::Into<crate::model::AdaptiveMtFile>,
1465    {
1466        self.adaptive_mt_file = v.map(|x| x.into());
1467        self
1468    }
1469}
1470
1471impl wkt::message::Message for ImportAdaptiveMtFileResponse {
1472    fn typename() -> &'static str {
1473        "type.googleapis.com/google.cloud.translation.v3.ImportAdaptiveMtFileResponse"
1474    }
1475}
1476
1477/// The request to list all AdaptiveMt files under a given dataset.
1478#[derive(Clone, Default, PartialEq)]
1479#[non_exhaustive]
1480pub struct ListAdaptiveMtFilesRequest {
1481    /// Required. The resource name of the project from which to list the Adaptive
1482    /// MT files.
1483    /// `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
1484    pub parent: std::string::String,
1485
1486    /// Optional.
1487    pub page_size: i32,
1488
1489    /// Optional. A token identifying a page of results the server should return.
1490    /// Typically, this is the value of
1491    /// ListAdaptiveMtFilesResponse.next_page_token returned from the
1492    /// previous call to `ListAdaptiveMtFiles` method. The first page is
1493    /// returned if `page_token`is empty or missing.
1494    pub page_token: std::string::String,
1495
1496    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1497}
1498
1499impl ListAdaptiveMtFilesRequest {
1500    pub fn new() -> Self {
1501        std::default::Default::default()
1502    }
1503
1504    /// Sets the value of [parent][crate::model::ListAdaptiveMtFilesRequest::parent].
1505    ///
1506    /// # Example
1507    /// ```ignore,no_run
1508    /// # use google_cloud_translation_v3::model::ListAdaptiveMtFilesRequest;
1509    /// let x = ListAdaptiveMtFilesRequest::new().set_parent("example");
1510    /// ```
1511    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1512        self.parent = v.into();
1513        self
1514    }
1515
1516    /// Sets the value of [page_size][crate::model::ListAdaptiveMtFilesRequest::page_size].
1517    ///
1518    /// # Example
1519    /// ```ignore,no_run
1520    /// # use google_cloud_translation_v3::model::ListAdaptiveMtFilesRequest;
1521    /// let x = ListAdaptiveMtFilesRequest::new().set_page_size(42);
1522    /// ```
1523    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1524        self.page_size = v.into();
1525        self
1526    }
1527
1528    /// Sets the value of [page_token][crate::model::ListAdaptiveMtFilesRequest::page_token].
1529    ///
1530    /// # Example
1531    /// ```ignore,no_run
1532    /// # use google_cloud_translation_v3::model::ListAdaptiveMtFilesRequest;
1533    /// let x = ListAdaptiveMtFilesRequest::new().set_page_token("example");
1534    /// ```
1535    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1536        self.page_token = v.into();
1537        self
1538    }
1539}
1540
1541impl wkt::message::Message for ListAdaptiveMtFilesRequest {
1542    fn typename() -> &'static str {
1543        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtFilesRequest"
1544    }
1545}
1546
1547/// The response for listing all AdaptiveMt files under a given dataset.
1548#[derive(Clone, Default, PartialEq)]
1549#[non_exhaustive]
1550pub struct ListAdaptiveMtFilesResponse {
1551    /// Output only. The Adaptive MT files.
1552    pub adaptive_mt_files: std::vec::Vec<crate::model::AdaptiveMtFile>,
1553
1554    /// Optional. A token to retrieve a page of results. Pass this value in the
1555    /// ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
1556    /// `ListAdaptiveMtFiles` method to retrieve the next page of results.
1557    pub next_page_token: std::string::String,
1558
1559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1560}
1561
1562impl ListAdaptiveMtFilesResponse {
1563    pub fn new() -> Self {
1564        std::default::Default::default()
1565    }
1566
1567    /// Sets the value of [adaptive_mt_files][crate::model::ListAdaptiveMtFilesResponse::adaptive_mt_files].
1568    ///
1569    /// # Example
1570    /// ```ignore,no_run
1571    /// # use google_cloud_translation_v3::model::ListAdaptiveMtFilesResponse;
1572    /// use google_cloud_translation_v3::model::AdaptiveMtFile;
1573    /// let x = ListAdaptiveMtFilesResponse::new()
1574    ///     .set_adaptive_mt_files([
1575    ///         AdaptiveMtFile::default()/* use setters */,
1576    ///         AdaptiveMtFile::default()/* use (different) setters */,
1577    ///     ]);
1578    /// ```
1579    pub fn set_adaptive_mt_files<T, V>(mut self, v: T) -> Self
1580    where
1581        T: std::iter::IntoIterator<Item = V>,
1582        V: std::convert::Into<crate::model::AdaptiveMtFile>,
1583    {
1584        use std::iter::Iterator;
1585        self.adaptive_mt_files = v.into_iter().map(|i| i.into()).collect();
1586        self
1587    }
1588
1589    /// Sets the value of [next_page_token][crate::model::ListAdaptiveMtFilesResponse::next_page_token].
1590    ///
1591    /// # Example
1592    /// ```ignore,no_run
1593    /// # use google_cloud_translation_v3::model::ListAdaptiveMtFilesResponse;
1594    /// let x = ListAdaptiveMtFilesResponse::new().set_next_page_token("example");
1595    /// ```
1596    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1597        self.next_page_token = v.into();
1598        self
1599    }
1600}
1601
1602impl wkt::message::Message for ListAdaptiveMtFilesResponse {
1603    fn typename() -> &'static str {
1604        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtFilesResponse"
1605    }
1606}
1607
1608#[doc(hidden)]
1609impl google_cloud_gax::paginator::internal::PageableResponse for ListAdaptiveMtFilesResponse {
1610    type PageItem = crate::model::AdaptiveMtFile;
1611
1612    fn items(self) -> std::vec::Vec<Self::PageItem> {
1613        self.adaptive_mt_files
1614    }
1615
1616    fn next_page_token(&self) -> std::string::String {
1617        use std::clone::Clone;
1618        self.next_page_token.clone()
1619    }
1620}
1621
1622/// An AdaptiveMt sentence entry.
1623#[derive(Clone, Default, PartialEq)]
1624#[non_exhaustive]
1625pub struct AdaptiveMtSentence {
1626    /// Required. The resource name of the file, in form of
1627    /// `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
1628    pub name: std::string::String,
1629
1630    /// Required. The source sentence.
1631    pub source_sentence: std::string::String,
1632
1633    /// Required. The target sentence.
1634    pub target_sentence: std::string::String,
1635
1636    /// Output only. Timestamp when this sentence was created.
1637    pub create_time: std::option::Option<wkt::Timestamp>,
1638
1639    /// Output only. Timestamp when this sentence was last updated.
1640    pub update_time: std::option::Option<wkt::Timestamp>,
1641
1642    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1643}
1644
1645impl AdaptiveMtSentence {
1646    pub fn new() -> Self {
1647        std::default::Default::default()
1648    }
1649
1650    /// Sets the value of [name][crate::model::AdaptiveMtSentence::name].
1651    ///
1652    /// # Example
1653    /// ```ignore,no_run
1654    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1655    /// let x = AdaptiveMtSentence::new().set_name("example");
1656    /// ```
1657    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1658        self.name = v.into();
1659        self
1660    }
1661
1662    /// Sets the value of [source_sentence][crate::model::AdaptiveMtSentence::source_sentence].
1663    ///
1664    /// # Example
1665    /// ```ignore,no_run
1666    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1667    /// let x = AdaptiveMtSentence::new().set_source_sentence("example");
1668    /// ```
1669    pub fn set_source_sentence<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1670        self.source_sentence = v.into();
1671        self
1672    }
1673
1674    /// Sets the value of [target_sentence][crate::model::AdaptiveMtSentence::target_sentence].
1675    ///
1676    /// # Example
1677    /// ```ignore,no_run
1678    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1679    /// let x = AdaptiveMtSentence::new().set_target_sentence("example");
1680    /// ```
1681    pub fn set_target_sentence<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1682        self.target_sentence = v.into();
1683        self
1684    }
1685
1686    /// Sets the value of [create_time][crate::model::AdaptiveMtSentence::create_time].
1687    ///
1688    /// # Example
1689    /// ```ignore,no_run
1690    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1691    /// use wkt::Timestamp;
1692    /// let x = AdaptiveMtSentence::new().set_create_time(Timestamp::default()/* use setters */);
1693    /// ```
1694    pub fn set_create_time<T>(mut self, v: T) -> Self
1695    where
1696        T: std::convert::Into<wkt::Timestamp>,
1697    {
1698        self.create_time = std::option::Option::Some(v.into());
1699        self
1700    }
1701
1702    /// Sets or clears the value of [create_time][crate::model::AdaptiveMtSentence::create_time].
1703    ///
1704    /// # Example
1705    /// ```ignore,no_run
1706    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1707    /// use wkt::Timestamp;
1708    /// let x = AdaptiveMtSentence::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1709    /// let x = AdaptiveMtSentence::new().set_or_clear_create_time(None::<Timestamp>);
1710    /// ```
1711    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1712    where
1713        T: std::convert::Into<wkt::Timestamp>,
1714    {
1715        self.create_time = v.map(|x| x.into());
1716        self
1717    }
1718
1719    /// Sets the value of [update_time][crate::model::AdaptiveMtSentence::update_time].
1720    ///
1721    /// # Example
1722    /// ```ignore,no_run
1723    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1724    /// use wkt::Timestamp;
1725    /// let x = AdaptiveMtSentence::new().set_update_time(Timestamp::default()/* use setters */);
1726    /// ```
1727    pub fn set_update_time<T>(mut self, v: T) -> Self
1728    where
1729        T: std::convert::Into<wkt::Timestamp>,
1730    {
1731        self.update_time = std::option::Option::Some(v.into());
1732        self
1733    }
1734
1735    /// Sets or clears the value of [update_time][crate::model::AdaptiveMtSentence::update_time].
1736    ///
1737    /// # Example
1738    /// ```ignore,no_run
1739    /// # use google_cloud_translation_v3::model::AdaptiveMtSentence;
1740    /// use wkt::Timestamp;
1741    /// let x = AdaptiveMtSentence::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1742    /// let x = AdaptiveMtSentence::new().set_or_clear_update_time(None::<Timestamp>);
1743    /// ```
1744    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1745    where
1746        T: std::convert::Into<wkt::Timestamp>,
1747    {
1748        self.update_time = v.map(|x| x.into());
1749        self
1750    }
1751}
1752
1753impl wkt::message::Message for AdaptiveMtSentence {
1754    fn typename() -> &'static str {
1755        "type.googleapis.com/google.cloud.translation.v3.AdaptiveMtSentence"
1756    }
1757}
1758
1759/// The request for listing Adaptive MT sentences from a Dataset/File.
1760#[derive(Clone, Default, PartialEq)]
1761#[non_exhaustive]
1762pub struct ListAdaptiveMtSentencesRequest {
1763    /// Required. The resource name of the project from which to list the Adaptive
1764    /// MT files. The following format lists all sentences under a file.
1765    /// `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
1766    /// The following format lists all sentences within a dataset.
1767    /// `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
1768    pub parent: std::string::String,
1769
1770    pub page_size: i32,
1771
1772    /// A token identifying a page of results the server should return.
1773    /// Typically, this is the value of
1774    /// ListAdaptiveMtSentencesRequest.next_page_token returned from the
1775    /// previous call to `ListTranslationMemories` method. The first page is
1776    /// returned if `page_token` is empty or missing.
1777    pub page_token: std::string::String,
1778
1779    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780}
1781
1782impl ListAdaptiveMtSentencesRequest {
1783    pub fn new() -> Self {
1784        std::default::Default::default()
1785    }
1786
1787    /// Sets the value of [parent][crate::model::ListAdaptiveMtSentencesRequest::parent].
1788    ///
1789    /// # Example
1790    /// ```ignore,no_run
1791    /// # use google_cloud_translation_v3::model::ListAdaptiveMtSentencesRequest;
1792    /// let x = ListAdaptiveMtSentencesRequest::new().set_parent("example");
1793    /// ```
1794    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1795        self.parent = v.into();
1796        self
1797    }
1798
1799    /// Sets the value of [page_size][crate::model::ListAdaptiveMtSentencesRequest::page_size].
1800    ///
1801    /// # Example
1802    /// ```ignore,no_run
1803    /// # use google_cloud_translation_v3::model::ListAdaptiveMtSentencesRequest;
1804    /// let x = ListAdaptiveMtSentencesRequest::new().set_page_size(42);
1805    /// ```
1806    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1807        self.page_size = v.into();
1808        self
1809    }
1810
1811    /// Sets the value of [page_token][crate::model::ListAdaptiveMtSentencesRequest::page_token].
1812    ///
1813    /// # Example
1814    /// ```ignore,no_run
1815    /// # use google_cloud_translation_v3::model::ListAdaptiveMtSentencesRequest;
1816    /// let x = ListAdaptiveMtSentencesRequest::new().set_page_token("example");
1817    /// ```
1818    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1819        self.page_token = v.into();
1820        self
1821    }
1822}
1823
1824impl wkt::message::Message for ListAdaptiveMtSentencesRequest {
1825    fn typename() -> &'static str {
1826        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtSentencesRequest"
1827    }
1828}
1829
1830/// List AdaptiveMt sentences response.
1831#[derive(Clone, Default, PartialEq)]
1832#[non_exhaustive]
1833pub struct ListAdaptiveMtSentencesResponse {
1834    /// Output only. The list of AdaptiveMtSentences.
1835    pub adaptive_mt_sentences: std::vec::Vec<crate::model::AdaptiveMtSentence>,
1836
1837    /// Optional.
1838    pub next_page_token: std::string::String,
1839
1840    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1841}
1842
1843impl ListAdaptiveMtSentencesResponse {
1844    pub fn new() -> Self {
1845        std::default::Default::default()
1846    }
1847
1848    /// Sets the value of [adaptive_mt_sentences][crate::model::ListAdaptiveMtSentencesResponse::adaptive_mt_sentences].
1849    ///
1850    /// # Example
1851    /// ```ignore,no_run
1852    /// # use google_cloud_translation_v3::model::ListAdaptiveMtSentencesResponse;
1853    /// use google_cloud_translation_v3::model::AdaptiveMtSentence;
1854    /// let x = ListAdaptiveMtSentencesResponse::new()
1855    ///     .set_adaptive_mt_sentences([
1856    ///         AdaptiveMtSentence::default()/* use setters */,
1857    ///         AdaptiveMtSentence::default()/* use (different) setters */,
1858    ///     ]);
1859    /// ```
1860    pub fn set_adaptive_mt_sentences<T, V>(mut self, v: T) -> Self
1861    where
1862        T: std::iter::IntoIterator<Item = V>,
1863        V: std::convert::Into<crate::model::AdaptiveMtSentence>,
1864    {
1865        use std::iter::Iterator;
1866        self.adaptive_mt_sentences = v.into_iter().map(|i| i.into()).collect();
1867        self
1868    }
1869
1870    /// Sets the value of [next_page_token][crate::model::ListAdaptiveMtSentencesResponse::next_page_token].
1871    ///
1872    /// # Example
1873    /// ```ignore,no_run
1874    /// # use google_cloud_translation_v3::model::ListAdaptiveMtSentencesResponse;
1875    /// let x = ListAdaptiveMtSentencesResponse::new().set_next_page_token("example");
1876    /// ```
1877    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1878        self.next_page_token = v.into();
1879        self
1880    }
1881}
1882
1883impl wkt::message::Message for ListAdaptiveMtSentencesResponse {
1884    fn typename() -> &'static str {
1885        "type.googleapis.com/google.cloud.translation.v3.ListAdaptiveMtSentencesResponse"
1886    }
1887}
1888
1889#[doc(hidden)]
1890impl google_cloud_gax::paginator::internal::PageableResponse for ListAdaptiveMtSentencesResponse {
1891    type PageItem = crate::model::AdaptiveMtSentence;
1892
1893    fn items(self) -> std::vec::Vec<Self::PageItem> {
1894        self.adaptive_mt_sentences
1895    }
1896
1897    fn next_page_token(&self) -> std::string::String {
1898        use std::clone::Clone;
1899        self.next_page_token.clone()
1900    }
1901}
1902
1903/// Request message for ImportData.
1904#[derive(Clone, Default, PartialEq)]
1905#[non_exhaustive]
1906pub struct ImportDataRequest {
1907    /// Required. Name of the dataset. In form of
1908    /// `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
1909    pub dataset: std::string::String,
1910
1911    /// Required. The config for the input content.
1912    pub input_config: std::option::Option<crate::model::DatasetInputConfig>,
1913
1914    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1915}
1916
1917impl ImportDataRequest {
1918    pub fn new() -> Self {
1919        std::default::Default::default()
1920    }
1921
1922    /// Sets the value of [dataset][crate::model::ImportDataRequest::dataset].
1923    ///
1924    /// # Example
1925    /// ```ignore,no_run
1926    /// # use google_cloud_translation_v3::model::ImportDataRequest;
1927    /// let x = ImportDataRequest::new().set_dataset("example");
1928    /// ```
1929    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1930        self.dataset = v.into();
1931        self
1932    }
1933
1934    /// Sets the value of [input_config][crate::model::ImportDataRequest::input_config].
1935    ///
1936    /// # Example
1937    /// ```ignore,no_run
1938    /// # use google_cloud_translation_v3::model::ImportDataRequest;
1939    /// use google_cloud_translation_v3::model::DatasetInputConfig;
1940    /// let x = ImportDataRequest::new().set_input_config(DatasetInputConfig::default()/* use setters */);
1941    /// ```
1942    pub fn set_input_config<T>(mut self, v: T) -> Self
1943    where
1944        T: std::convert::Into<crate::model::DatasetInputConfig>,
1945    {
1946        self.input_config = std::option::Option::Some(v.into());
1947        self
1948    }
1949
1950    /// Sets or clears the value of [input_config][crate::model::ImportDataRequest::input_config].
1951    ///
1952    /// # Example
1953    /// ```ignore,no_run
1954    /// # use google_cloud_translation_v3::model::ImportDataRequest;
1955    /// use google_cloud_translation_v3::model::DatasetInputConfig;
1956    /// let x = ImportDataRequest::new().set_or_clear_input_config(Some(DatasetInputConfig::default()/* use setters */));
1957    /// let x = ImportDataRequest::new().set_or_clear_input_config(None::<DatasetInputConfig>);
1958    /// ```
1959    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
1960    where
1961        T: std::convert::Into<crate::model::DatasetInputConfig>,
1962    {
1963        self.input_config = v.map(|x| x.into());
1964        self
1965    }
1966}
1967
1968impl wkt::message::Message for ImportDataRequest {
1969    fn typename() -> &'static str {
1970        "type.googleapis.com/google.cloud.translation.v3.ImportDataRequest"
1971    }
1972}
1973
1974/// Input configuration for datasets.
1975#[derive(Clone, Default, PartialEq)]
1976#[non_exhaustive]
1977pub struct DatasetInputConfig {
1978    /// Files containing the sentence pairs to be imported to the dataset.
1979    pub input_files: std::vec::Vec<crate::model::dataset_input_config::InputFile>,
1980
1981    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1982}
1983
1984impl DatasetInputConfig {
1985    pub fn new() -> Self {
1986        std::default::Default::default()
1987    }
1988
1989    /// Sets the value of [input_files][crate::model::DatasetInputConfig::input_files].
1990    ///
1991    /// # Example
1992    /// ```ignore,no_run
1993    /// # use google_cloud_translation_v3::model::DatasetInputConfig;
1994    /// use google_cloud_translation_v3::model::dataset_input_config::InputFile;
1995    /// let x = DatasetInputConfig::new()
1996    ///     .set_input_files([
1997    ///         InputFile::default()/* use setters */,
1998    ///         InputFile::default()/* use (different) setters */,
1999    ///     ]);
2000    /// ```
2001    pub fn set_input_files<T, V>(mut self, v: T) -> Self
2002    where
2003        T: std::iter::IntoIterator<Item = V>,
2004        V: std::convert::Into<crate::model::dataset_input_config::InputFile>,
2005    {
2006        use std::iter::Iterator;
2007        self.input_files = v.into_iter().map(|i| i.into()).collect();
2008        self
2009    }
2010}
2011
2012impl wkt::message::Message for DatasetInputConfig {
2013    fn typename() -> &'static str {
2014        "type.googleapis.com/google.cloud.translation.v3.DatasetInputConfig"
2015    }
2016}
2017
2018/// Defines additional types related to [DatasetInputConfig].
2019pub mod dataset_input_config {
2020    #[allow(unused_imports)]
2021    use super::*;
2022
2023    /// An input file.
2024    #[derive(Clone, Default, PartialEq)]
2025    #[non_exhaustive]
2026    pub struct InputFile {
2027        /// Optional. Usage of the file contents. Options are TRAIN|VALIDATION|TEST,
2028        /// or UNASSIGNED (by default) for auto split.
2029        pub usage: std::string::String,
2030
2031        /// Source of the file containing sentence pairs.
2032        /// Supported formats are tab-separated values (.tsv) and Translation Memory
2033        /// eXchange (.tmx) .
2034        pub source: std::option::Option<crate::model::dataset_input_config::input_file::Source>,
2035
2036        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2037    }
2038
2039    impl InputFile {
2040        pub fn new() -> Self {
2041            std::default::Default::default()
2042        }
2043
2044        /// Sets the value of [usage][crate::model::dataset_input_config::InputFile::usage].
2045        ///
2046        /// # Example
2047        /// ```ignore,no_run
2048        /// # use google_cloud_translation_v3::model::dataset_input_config::InputFile;
2049        /// let x = InputFile::new().set_usage("example");
2050        /// ```
2051        pub fn set_usage<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2052            self.usage = v.into();
2053            self
2054        }
2055
2056        /// Sets the value of [source][crate::model::dataset_input_config::InputFile::source].
2057        ///
2058        /// Note that all the setters affecting `source` are mutually
2059        /// exclusive.
2060        ///
2061        /// # Example
2062        /// ```ignore,no_run
2063        /// # use google_cloud_translation_v3::model::dataset_input_config::InputFile;
2064        /// use google_cloud_translation_v3::model::GcsInputSource;
2065        /// let x = InputFile::new().set_source(Some(
2066        ///     google_cloud_translation_v3::model::dataset_input_config::input_file::Source::GcsSource(GcsInputSource::default().into())));
2067        /// ```
2068        pub fn set_source<
2069            T: std::convert::Into<
2070                    std::option::Option<crate::model::dataset_input_config::input_file::Source>,
2071                >,
2072        >(
2073            mut self,
2074            v: T,
2075        ) -> Self {
2076            self.source = v.into();
2077            self
2078        }
2079
2080        /// The value of [source][crate::model::dataset_input_config::InputFile::source]
2081        /// if it holds a `GcsSource`, `None` if the field is not set or
2082        /// holds a different branch.
2083        pub fn gcs_source(
2084            &self,
2085        ) -> std::option::Option<&std::boxed::Box<crate::model::GcsInputSource>> {
2086            #[allow(unreachable_patterns)]
2087            self.source.as_ref().and_then(|v| match v {
2088                crate::model::dataset_input_config::input_file::Source::GcsSource(v) => {
2089                    std::option::Option::Some(v)
2090                }
2091                _ => std::option::Option::None,
2092            })
2093        }
2094
2095        /// Sets the value of [source][crate::model::dataset_input_config::InputFile::source]
2096        /// to hold a `GcsSource`.
2097        ///
2098        /// Note that all the setters affecting `source` are
2099        /// mutually exclusive.
2100        ///
2101        /// # Example
2102        /// ```ignore,no_run
2103        /// # use google_cloud_translation_v3::model::dataset_input_config::InputFile;
2104        /// use google_cloud_translation_v3::model::GcsInputSource;
2105        /// let x = InputFile::new().set_gcs_source(GcsInputSource::default()/* use setters */);
2106        /// assert!(x.gcs_source().is_some());
2107        /// ```
2108        pub fn set_gcs_source<
2109            T: std::convert::Into<std::boxed::Box<crate::model::GcsInputSource>>,
2110        >(
2111            mut self,
2112            v: T,
2113        ) -> Self {
2114            self.source = std::option::Option::Some(
2115                crate::model::dataset_input_config::input_file::Source::GcsSource(v.into()),
2116            );
2117            self
2118        }
2119    }
2120
2121    impl wkt::message::Message for InputFile {
2122        fn typename() -> &'static str {
2123            "type.googleapis.com/google.cloud.translation.v3.DatasetInputConfig.InputFile"
2124        }
2125    }
2126
2127    /// Defines additional types related to [InputFile].
2128    pub mod input_file {
2129        #[allow(unused_imports)]
2130        use super::*;
2131
2132        /// Source of the file containing sentence pairs.
2133        /// Supported formats are tab-separated values (.tsv) and Translation Memory
2134        /// eXchange (.tmx) .
2135        #[derive(Clone, Debug, PartialEq)]
2136        #[non_exhaustive]
2137        pub enum Source {
2138            /// Google Cloud Storage file source.
2139            GcsSource(std::boxed::Box<crate::model::GcsInputSource>),
2140        }
2141    }
2142}
2143
2144/// Metadata of import data operation.
2145#[derive(Clone, Default, PartialEq)]
2146#[non_exhaustive]
2147pub struct ImportDataMetadata {
2148    /// The current state of the operation.
2149    pub state: crate::model::OperationState,
2150
2151    /// The creation time of the operation.
2152    pub create_time: std::option::Option<wkt::Timestamp>,
2153
2154    /// The last update time of the operation.
2155    pub update_time: std::option::Option<wkt::Timestamp>,
2156
2157    /// Only populated when operation doesn't succeed.
2158    pub error: std::option::Option<google_cloud_rpc::model::Status>,
2159
2160    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2161}
2162
2163impl ImportDataMetadata {
2164    pub fn new() -> Self {
2165        std::default::Default::default()
2166    }
2167
2168    /// Sets the value of [state][crate::model::ImportDataMetadata::state].
2169    ///
2170    /// # Example
2171    /// ```ignore,no_run
2172    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2173    /// use google_cloud_translation_v3::model::OperationState;
2174    /// let x0 = ImportDataMetadata::new().set_state(OperationState::Running);
2175    /// let x1 = ImportDataMetadata::new().set_state(OperationState::Succeeded);
2176    /// let x2 = ImportDataMetadata::new().set_state(OperationState::Failed);
2177    /// ```
2178    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
2179        self.state = v.into();
2180        self
2181    }
2182
2183    /// Sets the value of [create_time][crate::model::ImportDataMetadata::create_time].
2184    ///
2185    /// # Example
2186    /// ```ignore,no_run
2187    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2188    /// use wkt::Timestamp;
2189    /// let x = ImportDataMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2190    /// ```
2191    pub fn set_create_time<T>(mut self, v: T) -> Self
2192    where
2193        T: std::convert::Into<wkt::Timestamp>,
2194    {
2195        self.create_time = std::option::Option::Some(v.into());
2196        self
2197    }
2198
2199    /// Sets or clears the value of [create_time][crate::model::ImportDataMetadata::create_time].
2200    ///
2201    /// # Example
2202    /// ```ignore,no_run
2203    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2204    /// use wkt::Timestamp;
2205    /// let x = ImportDataMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2206    /// let x = ImportDataMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2207    /// ```
2208    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2209    where
2210        T: std::convert::Into<wkt::Timestamp>,
2211    {
2212        self.create_time = v.map(|x| x.into());
2213        self
2214    }
2215
2216    /// Sets the value of [update_time][crate::model::ImportDataMetadata::update_time].
2217    ///
2218    /// # Example
2219    /// ```ignore,no_run
2220    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2221    /// use wkt::Timestamp;
2222    /// let x = ImportDataMetadata::new().set_update_time(Timestamp::default()/* use setters */);
2223    /// ```
2224    pub fn set_update_time<T>(mut self, v: T) -> Self
2225    where
2226        T: std::convert::Into<wkt::Timestamp>,
2227    {
2228        self.update_time = std::option::Option::Some(v.into());
2229        self
2230    }
2231
2232    /// Sets or clears the value of [update_time][crate::model::ImportDataMetadata::update_time].
2233    ///
2234    /// # Example
2235    /// ```ignore,no_run
2236    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2237    /// use wkt::Timestamp;
2238    /// let x = ImportDataMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2239    /// let x = ImportDataMetadata::new().set_or_clear_update_time(None::<Timestamp>);
2240    /// ```
2241    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2242    where
2243        T: std::convert::Into<wkt::Timestamp>,
2244    {
2245        self.update_time = v.map(|x| x.into());
2246        self
2247    }
2248
2249    /// Sets the value of [error][crate::model::ImportDataMetadata::error].
2250    ///
2251    /// # Example
2252    /// ```ignore,no_run
2253    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2254    /// use google_cloud_rpc::model::Status;
2255    /// let x = ImportDataMetadata::new().set_error(Status::default()/* use setters */);
2256    /// ```
2257    pub fn set_error<T>(mut self, v: T) -> Self
2258    where
2259        T: std::convert::Into<google_cloud_rpc::model::Status>,
2260    {
2261        self.error = std::option::Option::Some(v.into());
2262        self
2263    }
2264
2265    /// Sets or clears the value of [error][crate::model::ImportDataMetadata::error].
2266    ///
2267    /// # Example
2268    /// ```ignore,no_run
2269    /// # use google_cloud_translation_v3::model::ImportDataMetadata;
2270    /// use google_cloud_rpc::model::Status;
2271    /// let x = ImportDataMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
2272    /// let x = ImportDataMetadata::new().set_or_clear_error(None::<Status>);
2273    /// ```
2274    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2275    where
2276        T: std::convert::Into<google_cloud_rpc::model::Status>,
2277    {
2278        self.error = v.map(|x| x.into());
2279        self
2280    }
2281}
2282
2283impl wkt::message::Message for ImportDataMetadata {
2284    fn typename() -> &'static str {
2285        "type.googleapis.com/google.cloud.translation.v3.ImportDataMetadata"
2286    }
2287}
2288
2289/// Request message for ExportData.
2290#[derive(Clone, Default, PartialEq)]
2291#[non_exhaustive]
2292pub struct ExportDataRequest {
2293    /// Required. Name of the dataset. In form of
2294    /// `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
2295    pub dataset: std::string::String,
2296
2297    /// Required. The config for the output content.
2298    pub output_config: std::option::Option<crate::model::DatasetOutputConfig>,
2299
2300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2301}
2302
2303impl ExportDataRequest {
2304    pub fn new() -> Self {
2305        std::default::Default::default()
2306    }
2307
2308    /// Sets the value of [dataset][crate::model::ExportDataRequest::dataset].
2309    ///
2310    /// # Example
2311    /// ```ignore,no_run
2312    /// # use google_cloud_translation_v3::model::ExportDataRequest;
2313    /// let x = ExportDataRequest::new().set_dataset("example");
2314    /// ```
2315    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2316        self.dataset = v.into();
2317        self
2318    }
2319
2320    /// Sets the value of [output_config][crate::model::ExportDataRequest::output_config].
2321    ///
2322    /// # Example
2323    /// ```ignore,no_run
2324    /// # use google_cloud_translation_v3::model::ExportDataRequest;
2325    /// use google_cloud_translation_v3::model::DatasetOutputConfig;
2326    /// let x = ExportDataRequest::new().set_output_config(DatasetOutputConfig::default()/* use setters */);
2327    /// ```
2328    pub fn set_output_config<T>(mut self, v: T) -> Self
2329    where
2330        T: std::convert::Into<crate::model::DatasetOutputConfig>,
2331    {
2332        self.output_config = std::option::Option::Some(v.into());
2333        self
2334    }
2335
2336    /// Sets or clears the value of [output_config][crate::model::ExportDataRequest::output_config].
2337    ///
2338    /// # Example
2339    /// ```ignore,no_run
2340    /// # use google_cloud_translation_v3::model::ExportDataRequest;
2341    /// use google_cloud_translation_v3::model::DatasetOutputConfig;
2342    /// let x = ExportDataRequest::new().set_or_clear_output_config(Some(DatasetOutputConfig::default()/* use setters */));
2343    /// let x = ExportDataRequest::new().set_or_clear_output_config(None::<DatasetOutputConfig>);
2344    /// ```
2345    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
2346    where
2347        T: std::convert::Into<crate::model::DatasetOutputConfig>,
2348    {
2349        self.output_config = v.map(|x| x.into());
2350        self
2351    }
2352}
2353
2354impl wkt::message::Message for ExportDataRequest {
2355    fn typename() -> &'static str {
2356        "type.googleapis.com/google.cloud.translation.v3.ExportDataRequest"
2357    }
2358}
2359
2360/// Output configuration for datasets.
2361#[derive(Clone, Default, PartialEq)]
2362#[non_exhaustive]
2363pub struct DatasetOutputConfig {
2364    /// Required. Specify the output.
2365    pub destination: std::option::Option<crate::model::dataset_output_config::Destination>,
2366
2367    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2368}
2369
2370impl DatasetOutputConfig {
2371    pub fn new() -> Self {
2372        std::default::Default::default()
2373    }
2374
2375    /// Sets the value of [destination][crate::model::DatasetOutputConfig::destination].
2376    ///
2377    /// Note that all the setters affecting `destination` are mutually
2378    /// exclusive.
2379    ///
2380    /// # Example
2381    /// ```ignore,no_run
2382    /// # use google_cloud_translation_v3::model::DatasetOutputConfig;
2383    /// use google_cloud_translation_v3::model::GcsOutputDestination;
2384    /// let x = DatasetOutputConfig::new().set_destination(Some(
2385    ///     google_cloud_translation_v3::model::dataset_output_config::Destination::GcsDestination(GcsOutputDestination::default().into())));
2386    /// ```
2387    pub fn set_destination<
2388        T: std::convert::Into<std::option::Option<crate::model::dataset_output_config::Destination>>,
2389    >(
2390        mut self,
2391        v: T,
2392    ) -> Self {
2393        self.destination = v.into();
2394        self
2395    }
2396
2397    /// The value of [destination][crate::model::DatasetOutputConfig::destination]
2398    /// if it holds a `GcsDestination`, `None` if the field is not set or
2399    /// holds a different branch.
2400    pub fn gcs_destination(
2401        &self,
2402    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsOutputDestination>> {
2403        #[allow(unreachable_patterns)]
2404        self.destination.as_ref().and_then(|v| match v {
2405            crate::model::dataset_output_config::Destination::GcsDestination(v) => {
2406                std::option::Option::Some(v)
2407            }
2408            _ => std::option::Option::None,
2409        })
2410    }
2411
2412    /// Sets the value of [destination][crate::model::DatasetOutputConfig::destination]
2413    /// to hold a `GcsDestination`.
2414    ///
2415    /// Note that all the setters affecting `destination` are
2416    /// mutually exclusive.
2417    ///
2418    /// # Example
2419    /// ```ignore,no_run
2420    /// # use google_cloud_translation_v3::model::DatasetOutputConfig;
2421    /// use google_cloud_translation_v3::model::GcsOutputDestination;
2422    /// let x = DatasetOutputConfig::new().set_gcs_destination(GcsOutputDestination::default()/* use setters */);
2423    /// assert!(x.gcs_destination().is_some());
2424    /// ```
2425    pub fn set_gcs_destination<
2426        T: std::convert::Into<std::boxed::Box<crate::model::GcsOutputDestination>>,
2427    >(
2428        mut self,
2429        v: T,
2430    ) -> Self {
2431        self.destination = std::option::Option::Some(
2432            crate::model::dataset_output_config::Destination::GcsDestination(v.into()),
2433        );
2434        self
2435    }
2436}
2437
2438impl wkt::message::Message for DatasetOutputConfig {
2439    fn typename() -> &'static str {
2440        "type.googleapis.com/google.cloud.translation.v3.DatasetOutputConfig"
2441    }
2442}
2443
2444/// Defines additional types related to [DatasetOutputConfig].
2445pub mod dataset_output_config {
2446    #[allow(unused_imports)]
2447    use super::*;
2448
2449    /// Required. Specify the output.
2450    #[derive(Clone, Debug, PartialEq)]
2451    #[non_exhaustive]
2452    pub enum Destination {
2453        /// Google Cloud Storage destination to write the output.
2454        GcsDestination(std::boxed::Box<crate::model::GcsOutputDestination>),
2455    }
2456}
2457
2458/// Metadata of export data operation.
2459#[derive(Clone, Default, PartialEq)]
2460#[non_exhaustive]
2461pub struct ExportDataMetadata {
2462    /// The current state of the operation.
2463    pub state: crate::model::OperationState,
2464
2465    /// The creation time of the operation.
2466    pub create_time: std::option::Option<wkt::Timestamp>,
2467
2468    /// The last update time of the operation.
2469    pub update_time: std::option::Option<wkt::Timestamp>,
2470
2471    /// Only populated when operation doesn't succeed.
2472    pub error: std::option::Option<google_cloud_rpc::model::Status>,
2473
2474    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2475}
2476
2477impl ExportDataMetadata {
2478    pub fn new() -> Self {
2479        std::default::Default::default()
2480    }
2481
2482    /// Sets the value of [state][crate::model::ExportDataMetadata::state].
2483    ///
2484    /// # Example
2485    /// ```ignore,no_run
2486    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2487    /// use google_cloud_translation_v3::model::OperationState;
2488    /// let x0 = ExportDataMetadata::new().set_state(OperationState::Running);
2489    /// let x1 = ExportDataMetadata::new().set_state(OperationState::Succeeded);
2490    /// let x2 = ExportDataMetadata::new().set_state(OperationState::Failed);
2491    /// ```
2492    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
2493        self.state = v.into();
2494        self
2495    }
2496
2497    /// Sets the value of [create_time][crate::model::ExportDataMetadata::create_time].
2498    ///
2499    /// # Example
2500    /// ```ignore,no_run
2501    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2502    /// use wkt::Timestamp;
2503    /// let x = ExportDataMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2504    /// ```
2505    pub fn set_create_time<T>(mut self, v: T) -> Self
2506    where
2507        T: std::convert::Into<wkt::Timestamp>,
2508    {
2509        self.create_time = std::option::Option::Some(v.into());
2510        self
2511    }
2512
2513    /// Sets or clears the value of [create_time][crate::model::ExportDataMetadata::create_time].
2514    ///
2515    /// # Example
2516    /// ```ignore,no_run
2517    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2518    /// use wkt::Timestamp;
2519    /// let x = ExportDataMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2520    /// let x = ExportDataMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2521    /// ```
2522    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2523    where
2524        T: std::convert::Into<wkt::Timestamp>,
2525    {
2526        self.create_time = v.map(|x| x.into());
2527        self
2528    }
2529
2530    /// Sets the value of [update_time][crate::model::ExportDataMetadata::update_time].
2531    ///
2532    /// # Example
2533    /// ```ignore,no_run
2534    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2535    /// use wkt::Timestamp;
2536    /// let x = ExportDataMetadata::new().set_update_time(Timestamp::default()/* use setters */);
2537    /// ```
2538    pub fn set_update_time<T>(mut self, v: T) -> Self
2539    where
2540        T: std::convert::Into<wkt::Timestamp>,
2541    {
2542        self.update_time = std::option::Option::Some(v.into());
2543        self
2544    }
2545
2546    /// Sets or clears the value of [update_time][crate::model::ExportDataMetadata::update_time].
2547    ///
2548    /// # Example
2549    /// ```ignore,no_run
2550    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2551    /// use wkt::Timestamp;
2552    /// let x = ExportDataMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2553    /// let x = ExportDataMetadata::new().set_or_clear_update_time(None::<Timestamp>);
2554    /// ```
2555    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2556    where
2557        T: std::convert::Into<wkt::Timestamp>,
2558    {
2559        self.update_time = v.map(|x| x.into());
2560        self
2561    }
2562
2563    /// Sets the value of [error][crate::model::ExportDataMetadata::error].
2564    ///
2565    /// # Example
2566    /// ```ignore,no_run
2567    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2568    /// use google_cloud_rpc::model::Status;
2569    /// let x = ExportDataMetadata::new().set_error(Status::default()/* use setters */);
2570    /// ```
2571    pub fn set_error<T>(mut self, v: T) -> Self
2572    where
2573        T: std::convert::Into<google_cloud_rpc::model::Status>,
2574    {
2575        self.error = std::option::Option::Some(v.into());
2576        self
2577    }
2578
2579    /// Sets or clears the value of [error][crate::model::ExportDataMetadata::error].
2580    ///
2581    /// # Example
2582    /// ```ignore,no_run
2583    /// # use google_cloud_translation_v3::model::ExportDataMetadata;
2584    /// use google_cloud_rpc::model::Status;
2585    /// let x = ExportDataMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
2586    /// let x = ExportDataMetadata::new().set_or_clear_error(None::<Status>);
2587    /// ```
2588    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2589    where
2590        T: std::convert::Into<google_cloud_rpc::model::Status>,
2591    {
2592        self.error = v.map(|x| x.into());
2593        self
2594    }
2595}
2596
2597impl wkt::message::Message for ExportDataMetadata {
2598    fn typename() -> &'static str {
2599        "type.googleapis.com/google.cloud.translation.v3.ExportDataMetadata"
2600    }
2601}
2602
2603/// Request message for DeleteDataset.
2604#[derive(Clone, Default, PartialEq)]
2605#[non_exhaustive]
2606pub struct DeleteDatasetRequest {
2607    /// Required. The name of the dataset to delete.
2608    pub name: std::string::String,
2609
2610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2611}
2612
2613impl DeleteDatasetRequest {
2614    pub fn new() -> Self {
2615        std::default::Default::default()
2616    }
2617
2618    /// Sets the value of [name][crate::model::DeleteDatasetRequest::name].
2619    ///
2620    /// # Example
2621    /// ```ignore,no_run
2622    /// # use google_cloud_translation_v3::model::DeleteDatasetRequest;
2623    /// let x = DeleteDatasetRequest::new().set_name("example");
2624    /// ```
2625    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2626        self.name = v.into();
2627        self
2628    }
2629}
2630
2631impl wkt::message::Message for DeleteDatasetRequest {
2632    fn typename() -> &'static str {
2633        "type.googleapis.com/google.cloud.translation.v3.DeleteDatasetRequest"
2634    }
2635}
2636
2637/// Metadata of delete dataset operation.
2638#[derive(Clone, Default, PartialEq)]
2639#[non_exhaustive]
2640pub struct DeleteDatasetMetadata {
2641    /// The current state of the operation.
2642    pub state: crate::model::OperationState,
2643
2644    /// The creation time of the operation.
2645    pub create_time: std::option::Option<wkt::Timestamp>,
2646
2647    /// The last update time of the operation.
2648    pub update_time: std::option::Option<wkt::Timestamp>,
2649
2650    /// Only populated when operation doesn't succeed.
2651    pub error: std::option::Option<google_cloud_rpc::model::Status>,
2652
2653    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2654}
2655
2656impl DeleteDatasetMetadata {
2657    pub fn new() -> Self {
2658        std::default::Default::default()
2659    }
2660
2661    /// Sets the value of [state][crate::model::DeleteDatasetMetadata::state].
2662    ///
2663    /// # Example
2664    /// ```ignore,no_run
2665    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2666    /// use google_cloud_translation_v3::model::OperationState;
2667    /// let x0 = DeleteDatasetMetadata::new().set_state(OperationState::Running);
2668    /// let x1 = DeleteDatasetMetadata::new().set_state(OperationState::Succeeded);
2669    /// let x2 = DeleteDatasetMetadata::new().set_state(OperationState::Failed);
2670    /// ```
2671    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
2672        self.state = v.into();
2673        self
2674    }
2675
2676    /// Sets the value of [create_time][crate::model::DeleteDatasetMetadata::create_time].
2677    ///
2678    /// # Example
2679    /// ```ignore,no_run
2680    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2681    /// use wkt::Timestamp;
2682    /// let x = DeleteDatasetMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2683    /// ```
2684    pub fn set_create_time<T>(mut self, v: T) -> Self
2685    where
2686        T: std::convert::Into<wkt::Timestamp>,
2687    {
2688        self.create_time = std::option::Option::Some(v.into());
2689        self
2690    }
2691
2692    /// Sets or clears the value of [create_time][crate::model::DeleteDatasetMetadata::create_time].
2693    ///
2694    /// # Example
2695    /// ```ignore,no_run
2696    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2697    /// use wkt::Timestamp;
2698    /// let x = DeleteDatasetMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2699    /// let x = DeleteDatasetMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2700    /// ```
2701    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2702    where
2703        T: std::convert::Into<wkt::Timestamp>,
2704    {
2705        self.create_time = v.map(|x| x.into());
2706        self
2707    }
2708
2709    /// Sets the value of [update_time][crate::model::DeleteDatasetMetadata::update_time].
2710    ///
2711    /// # Example
2712    /// ```ignore,no_run
2713    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2714    /// use wkt::Timestamp;
2715    /// let x = DeleteDatasetMetadata::new().set_update_time(Timestamp::default()/* use setters */);
2716    /// ```
2717    pub fn set_update_time<T>(mut self, v: T) -> Self
2718    where
2719        T: std::convert::Into<wkt::Timestamp>,
2720    {
2721        self.update_time = std::option::Option::Some(v.into());
2722        self
2723    }
2724
2725    /// Sets or clears the value of [update_time][crate::model::DeleteDatasetMetadata::update_time].
2726    ///
2727    /// # Example
2728    /// ```ignore,no_run
2729    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2730    /// use wkt::Timestamp;
2731    /// let x = DeleteDatasetMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2732    /// let x = DeleteDatasetMetadata::new().set_or_clear_update_time(None::<Timestamp>);
2733    /// ```
2734    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2735    where
2736        T: std::convert::Into<wkt::Timestamp>,
2737    {
2738        self.update_time = v.map(|x| x.into());
2739        self
2740    }
2741
2742    /// Sets the value of [error][crate::model::DeleteDatasetMetadata::error].
2743    ///
2744    /// # Example
2745    /// ```ignore,no_run
2746    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2747    /// use google_cloud_rpc::model::Status;
2748    /// let x = DeleteDatasetMetadata::new().set_error(Status::default()/* use setters */);
2749    /// ```
2750    pub fn set_error<T>(mut self, v: T) -> Self
2751    where
2752        T: std::convert::Into<google_cloud_rpc::model::Status>,
2753    {
2754        self.error = std::option::Option::Some(v.into());
2755        self
2756    }
2757
2758    /// Sets or clears the value of [error][crate::model::DeleteDatasetMetadata::error].
2759    ///
2760    /// # Example
2761    /// ```ignore,no_run
2762    /// # use google_cloud_translation_v3::model::DeleteDatasetMetadata;
2763    /// use google_cloud_rpc::model::Status;
2764    /// let x = DeleteDatasetMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
2765    /// let x = DeleteDatasetMetadata::new().set_or_clear_error(None::<Status>);
2766    /// ```
2767    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2768    where
2769        T: std::convert::Into<google_cloud_rpc::model::Status>,
2770    {
2771        self.error = v.map(|x| x.into());
2772        self
2773    }
2774}
2775
2776impl wkt::message::Message for DeleteDatasetMetadata {
2777    fn typename() -> &'static str {
2778        "type.googleapis.com/google.cloud.translation.v3.DeleteDatasetMetadata"
2779    }
2780}
2781
2782/// Request message for GetDataset.
2783#[derive(Clone, Default, PartialEq)]
2784#[non_exhaustive]
2785pub struct GetDatasetRequest {
2786    /// Required. The resource name of the dataset to retrieve.
2787    pub name: std::string::String,
2788
2789    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2790}
2791
2792impl GetDatasetRequest {
2793    pub fn new() -> Self {
2794        std::default::Default::default()
2795    }
2796
2797    /// Sets the value of [name][crate::model::GetDatasetRequest::name].
2798    ///
2799    /// # Example
2800    /// ```ignore,no_run
2801    /// # use google_cloud_translation_v3::model::GetDatasetRequest;
2802    /// let x = GetDatasetRequest::new().set_name("example");
2803    /// ```
2804    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2805        self.name = v.into();
2806        self
2807    }
2808}
2809
2810impl wkt::message::Message for GetDatasetRequest {
2811    fn typename() -> &'static str {
2812        "type.googleapis.com/google.cloud.translation.v3.GetDatasetRequest"
2813    }
2814}
2815
2816/// Request message for ListDatasets.
2817#[derive(Clone, Default, PartialEq)]
2818#[non_exhaustive]
2819pub struct ListDatasetsRequest {
2820    /// Required. Name of the parent project. In form of
2821    /// `projects/{project-number-or-id}/locations/{location-id}`
2822    pub parent: std::string::String,
2823
2824    /// Optional. Requested page size. The server can return fewer results than
2825    /// requested.
2826    pub page_size: i32,
2827
2828    /// Optional. A token identifying a page of results for the server to return.
2829    /// Typically obtained from next_page_token field in the response of a
2830    /// ListDatasets call.
2831    pub page_token: std::string::String,
2832
2833    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2834}
2835
2836impl ListDatasetsRequest {
2837    pub fn new() -> Self {
2838        std::default::Default::default()
2839    }
2840
2841    /// Sets the value of [parent][crate::model::ListDatasetsRequest::parent].
2842    ///
2843    /// # Example
2844    /// ```ignore,no_run
2845    /// # use google_cloud_translation_v3::model::ListDatasetsRequest;
2846    /// let x = ListDatasetsRequest::new().set_parent("example");
2847    /// ```
2848    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2849        self.parent = v.into();
2850        self
2851    }
2852
2853    /// Sets the value of [page_size][crate::model::ListDatasetsRequest::page_size].
2854    ///
2855    /// # Example
2856    /// ```ignore,no_run
2857    /// # use google_cloud_translation_v3::model::ListDatasetsRequest;
2858    /// let x = ListDatasetsRequest::new().set_page_size(42);
2859    /// ```
2860    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2861        self.page_size = v.into();
2862        self
2863    }
2864
2865    /// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
2866    ///
2867    /// # Example
2868    /// ```ignore,no_run
2869    /// # use google_cloud_translation_v3::model::ListDatasetsRequest;
2870    /// let x = ListDatasetsRequest::new().set_page_token("example");
2871    /// ```
2872    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2873        self.page_token = v.into();
2874        self
2875    }
2876}
2877
2878impl wkt::message::Message for ListDatasetsRequest {
2879    fn typename() -> &'static str {
2880        "type.googleapis.com/google.cloud.translation.v3.ListDatasetsRequest"
2881    }
2882}
2883
2884/// Response message for ListDatasets.
2885#[derive(Clone, Default, PartialEq)]
2886#[non_exhaustive]
2887pub struct ListDatasetsResponse {
2888    /// The datasets read.
2889    pub datasets: std::vec::Vec<crate::model::Dataset>,
2890
2891    /// A token to retrieve next page of results.
2892    /// Pass this token to the page_token field in the ListDatasetsRequest to
2893    /// obtain the corresponding page.
2894    pub next_page_token: std::string::String,
2895
2896    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2897}
2898
2899impl ListDatasetsResponse {
2900    pub fn new() -> Self {
2901        std::default::Default::default()
2902    }
2903
2904    /// Sets the value of [datasets][crate::model::ListDatasetsResponse::datasets].
2905    ///
2906    /// # Example
2907    /// ```ignore,no_run
2908    /// # use google_cloud_translation_v3::model::ListDatasetsResponse;
2909    /// use google_cloud_translation_v3::model::Dataset;
2910    /// let x = ListDatasetsResponse::new()
2911    ///     .set_datasets([
2912    ///         Dataset::default()/* use setters */,
2913    ///         Dataset::default()/* use (different) setters */,
2914    ///     ]);
2915    /// ```
2916    pub fn set_datasets<T, V>(mut self, v: T) -> Self
2917    where
2918        T: std::iter::IntoIterator<Item = V>,
2919        V: std::convert::Into<crate::model::Dataset>,
2920    {
2921        use std::iter::Iterator;
2922        self.datasets = v.into_iter().map(|i| i.into()).collect();
2923        self
2924    }
2925
2926    /// Sets the value of [next_page_token][crate::model::ListDatasetsResponse::next_page_token].
2927    ///
2928    /// # Example
2929    /// ```ignore,no_run
2930    /// # use google_cloud_translation_v3::model::ListDatasetsResponse;
2931    /// let x = ListDatasetsResponse::new().set_next_page_token("example");
2932    /// ```
2933    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2934        self.next_page_token = v.into();
2935        self
2936    }
2937}
2938
2939impl wkt::message::Message for ListDatasetsResponse {
2940    fn typename() -> &'static str {
2941        "type.googleapis.com/google.cloud.translation.v3.ListDatasetsResponse"
2942    }
2943}
2944
2945#[doc(hidden)]
2946impl google_cloud_gax::paginator::internal::PageableResponse for ListDatasetsResponse {
2947    type PageItem = crate::model::Dataset;
2948
2949    fn items(self) -> std::vec::Vec<Self::PageItem> {
2950        self.datasets
2951    }
2952
2953    fn next_page_token(&self) -> std::string::String {
2954        use std::clone::Clone;
2955        self.next_page_token.clone()
2956    }
2957}
2958
2959/// Request message for CreateDataset.
2960#[derive(Clone, Default, PartialEq)]
2961#[non_exhaustive]
2962pub struct CreateDatasetRequest {
2963    /// Required. The project name.
2964    pub parent: std::string::String,
2965
2966    /// Required. The Dataset to create.
2967    pub dataset: std::option::Option<crate::model::Dataset>,
2968
2969    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2970}
2971
2972impl CreateDatasetRequest {
2973    pub fn new() -> Self {
2974        std::default::Default::default()
2975    }
2976
2977    /// Sets the value of [parent][crate::model::CreateDatasetRequest::parent].
2978    ///
2979    /// # Example
2980    /// ```ignore,no_run
2981    /// # use google_cloud_translation_v3::model::CreateDatasetRequest;
2982    /// let x = CreateDatasetRequest::new().set_parent("example");
2983    /// ```
2984    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2985        self.parent = v.into();
2986        self
2987    }
2988
2989    /// Sets the value of [dataset][crate::model::CreateDatasetRequest::dataset].
2990    ///
2991    /// # Example
2992    /// ```ignore,no_run
2993    /// # use google_cloud_translation_v3::model::CreateDatasetRequest;
2994    /// use google_cloud_translation_v3::model::Dataset;
2995    /// let x = CreateDatasetRequest::new().set_dataset(Dataset::default()/* use setters */);
2996    /// ```
2997    pub fn set_dataset<T>(mut self, v: T) -> Self
2998    where
2999        T: std::convert::Into<crate::model::Dataset>,
3000    {
3001        self.dataset = std::option::Option::Some(v.into());
3002        self
3003    }
3004
3005    /// Sets or clears the value of [dataset][crate::model::CreateDatasetRequest::dataset].
3006    ///
3007    /// # Example
3008    /// ```ignore,no_run
3009    /// # use google_cloud_translation_v3::model::CreateDatasetRequest;
3010    /// use google_cloud_translation_v3::model::Dataset;
3011    /// let x = CreateDatasetRequest::new().set_or_clear_dataset(Some(Dataset::default()/* use setters */));
3012    /// let x = CreateDatasetRequest::new().set_or_clear_dataset(None::<Dataset>);
3013    /// ```
3014    pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
3015    where
3016        T: std::convert::Into<crate::model::Dataset>,
3017    {
3018        self.dataset = v.map(|x| x.into());
3019        self
3020    }
3021}
3022
3023impl wkt::message::Message for CreateDatasetRequest {
3024    fn typename() -> &'static str {
3025        "type.googleapis.com/google.cloud.translation.v3.CreateDatasetRequest"
3026    }
3027}
3028
3029/// Metadata of create dataset operation.
3030#[derive(Clone, Default, PartialEq)]
3031#[non_exhaustive]
3032pub struct CreateDatasetMetadata {
3033    /// The current state of the operation.
3034    pub state: crate::model::OperationState,
3035
3036    /// The creation time of the operation.
3037    pub create_time: std::option::Option<wkt::Timestamp>,
3038
3039    /// The last update time of the operation.
3040    pub update_time: std::option::Option<wkt::Timestamp>,
3041
3042    /// Only populated when operation doesn't succeed.
3043    pub error: std::option::Option<google_cloud_rpc::model::Status>,
3044
3045    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3046}
3047
3048impl CreateDatasetMetadata {
3049    pub fn new() -> Self {
3050        std::default::Default::default()
3051    }
3052
3053    /// Sets the value of [state][crate::model::CreateDatasetMetadata::state].
3054    ///
3055    /// # Example
3056    /// ```ignore,no_run
3057    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3058    /// use google_cloud_translation_v3::model::OperationState;
3059    /// let x0 = CreateDatasetMetadata::new().set_state(OperationState::Running);
3060    /// let x1 = CreateDatasetMetadata::new().set_state(OperationState::Succeeded);
3061    /// let x2 = CreateDatasetMetadata::new().set_state(OperationState::Failed);
3062    /// ```
3063    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
3064        self.state = v.into();
3065        self
3066    }
3067
3068    /// Sets the value of [create_time][crate::model::CreateDatasetMetadata::create_time].
3069    ///
3070    /// # Example
3071    /// ```ignore,no_run
3072    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3073    /// use wkt::Timestamp;
3074    /// let x = CreateDatasetMetadata::new().set_create_time(Timestamp::default()/* use setters */);
3075    /// ```
3076    pub fn set_create_time<T>(mut self, v: T) -> Self
3077    where
3078        T: std::convert::Into<wkt::Timestamp>,
3079    {
3080        self.create_time = std::option::Option::Some(v.into());
3081        self
3082    }
3083
3084    /// Sets or clears the value of [create_time][crate::model::CreateDatasetMetadata::create_time].
3085    ///
3086    /// # Example
3087    /// ```ignore,no_run
3088    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3089    /// use wkt::Timestamp;
3090    /// let x = CreateDatasetMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3091    /// let x = CreateDatasetMetadata::new().set_or_clear_create_time(None::<Timestamp>);
3092    /// ```
3093    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3094    where
3095        T: std::convert::Into<wkt::Timestamp>,
3096    {
3097        self.create_time = v.map(|x| x.into());
3098        self
3099    }
3100
3101    /// Sets the value of [update_time][crate::model::CreateDatasetMetadata::update_time].
3102    ///
3103    /// # Example
3104    /// ```ignore,no_run
3105    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3106    /// use wkt::Timestamp;
3107    /// let x = CreateDatasetMetadata::new().set_update_time(Timestamp::default()/* use setters */);
3108    /// ```
3109    pub fn set_update_time<T>(mut self, v: T) -> Self
3110    where
3111        T: std::convert::Into<wkt::Timestamp>,
3112    {
3113        self.update_time = std::option::Option::Some(v.into());
3114        self
3115    }
3116
3117    /// Sets or clears the value of [update_time][crate::model::CreateDatasetMetadata::update_time].
3118    ///
3119    /// # Example
3120    /// ```ignore,no_run
3121    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3122    /// use wkt::Timestamp;
3123    /// let x = CreateDatasetMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3124    /// let x = CreateDatasetMetadata::new().set_or_clear_update_time(None::<Timestamp>);
3125    /// ```
3126    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3127    where
3128        T: std::convert::Into<wkt::Timestamp>,
3129    {
3130        self.update_time = v.map(|x| x.into());
3131        self
3132    }
3133
3134    /// Sets the value of [error][crate::model::CreateDatasetMetadata::error].
3135    ///
3136    /// # Example
3137    /// ```ignore,no_run
3138    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3139    /// use google_cloud_rpc::model::Status;
3140    /// let x = CreateDatasetMetadata::new().set_error(Status::default()/* use setters */);
3141    /// ```
3142    pub fn set_error<T>(mut self, v: T) -> Self
3143    where
3144        T: std::convert::Into<google_cloud_rpc::model::Status>,
3145    {
3146        self.error = std::option::Option::Some(v.into());
3147        self
3148    }
3149
3150    /// Sets or clears the value of [error][crate::model::CreateDatasetMetadata::error].
3151    ///
3152    /// # Example
3153    /// ```ignore,no_run
3154    /// # use google_cloud_translation_v3::model::CreateDatasetMetadata;
3155    /// use google_cloud_rpc::model::Status;
3156    /// let x = CreateDatasetMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
3157    /// let x = CreateDatasetMetadata::new().set_or_clear_error(None::<Status>);
3158    /// ```
3159    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
3160    where
3161        T: std::convert::Into<google_cloud_rpc::model::Status>,
3162    {
3163        self.error = v.map(|x| x.into());
3164        self
3165    }
3166}
3167
3168impl wkt::message::Message for CreateDatasetMetadata {
3169    fn typename() -> &'static str {
3170        "type.googleapis.com/google.cloud.translation.v3.CreateDatasetMetadata"
3171    }
3172}
3173
3174/// Request message for ListExamples.
3175#[derive(Clone, Default, PartialEq)]
3176#[non_exhaustive]
3177pub struct ListExamplesRequest {
3178    /// Required. Name of the parent dataset. In form of
3179    /// `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
3180    pub parent: std::string::String,
3181
3182    /// Optional. An expression for filtering the examples that will be returned.
3183    /// Example filter:
3184    ///
3185    /// * `usage=TRAIN`
3186    pub filter: std::string::String,
3187
3188    /// Optional. Requested page size. The server can return fewer results than
3189    /// requested.
3190    pub page_size: i32,
3191
3192    /// Optional. A token identifying a page of results for the server to return.
3193    /// Typically obtained from next_page_token field in the response of a
3194    /// ListExamples call.
3195    pub page_token: std::string::String,
3196
3197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3198}
3199
3200impl ListExamplesRequest {
3201    pub fn new() -> Self {
3202        std::default::Default::default()
3203    }
3204
3205    /// Sets the value of [parent][crate::model::ListExamplesRequest::parent].
3206    ///
3207    /// # Example
3208    /// ```ignore,no_run
3209    /// # use google_cloud_translation_v3::model::ListExamplesRequest;
3210    /// let x = ListExamplesRequest::new().set_parent("example");
3211    /// ```
3212    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3213        self.parent = v.into();
3214        self
3215    }
3216
3217    /// Sets the value of [filter][crate::model::ListExamplesRequest::filter].
3218    ///
3219    /// # Example
3220    /// ```ignore,no_run
3221    /// # use google_cloud_translation_v3::model::ListExamplesRequest;
3222    /// let x = ListExamplesRequest::new().set_filter("example");
3223    /// ```
3224    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3225        self.filter = v.into();
3226        self
3227    }
3228
3229    /// Sets the value of [page_size][crate::model::ListExamplesRequest::page_size].
3230    ///
3231    /// # Example
3232    /// ```ignore,no_run
3233    /// # use google_cloud_translation_v3::model::ListExamplesRequest;
3234    /// let x = ListExamplesRequest::new().set_page_size(42);
3235    /// ```
3236    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3237        self.page_size = v.into();
3238        self
3239    }
3240
3241    /// Sets the value of [page_token][crate::model::ListExamplesRequest::page_token].
3242    ///
3243    /// # Example
3244    /// ```ignore,no_run
3245    /// # use google_cloud_translation_v3::model::ListExamplesRequest;
3246    /// let x = ListExamplesRequest::new().set_page_token("example");
3247    /// ```
3248    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3249        self.page_token = v.into();
3250        self
3251    }
3252}
3253
3254impl wkt::message::Message for ListExamplesRequest {
3255    fn typename() -> &'static str {
3256        "type.googleapis.com/google.cloud.translation.v3.ListExamplesRequest"
3257    }
3258}
3259
3260/// Response message for ListExamples.
3261#[derive(Clone, Default, PartialEq)]
3262#[non_exhaustive]
3263pub struct ListExamplesResponse {
3264    /// The sentence pairs.
3265    pub examples: std::vec::Vec<crate::model::Example>,
3266
3267    /// A token to retrieve next page of results.
3268    /// Pass this token to the page_token field in the ListExamplesRequest to
3269    /// obtain the corresponding page.
3270    pub next_page_token: std::string::String,
3271
3272    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3273}
3274
3275impl ListExamplesResponse {
3276    pub fn new() -> Self {
3277        std::default::Default::default()
3278    }
3279
3280    /// Sets the value of [examples][crate::model::ListExamplesResponse::examples].
3281    ///
3282    /// # Example
3283    /// ```ignore,no_run
3284    /// # use google_cloud_translation_v3::model::ListExamplesResponse;
3285    /// use google_cloud_translation_v3::model::Example;
3286    /// let x = ListExamplesResponse::new()
3287    ///     .set_examples([
3288    ///         Example::default()/* use setters */,
3289    ///         Example::default()/* use (different) setters */,
3290    ///     ]);
3291    /// ```
3292    pub fn set_examples<T, V>(mut self, v: T) -> Self
3293    where
3294        T: std::iter::IntoIterator<Item = V>,
3295        V: std::convert::Into<crate::model::Example>,
3296    {
3297        use std::iter::Iterator;
3298        self.examples = v.into_iter().map(|i| i.into()).collect();
3299        self
3300    }
3301
3302    /// Sets the value of [next_page_token][crate::model::ListExamplesResponse::next_page_token].
3303    ///
3304    /// # Example
3305    /// ```ignore,no_run
3306    /// # use google_cloud_translation_v3::model::ListExamplesResponse;
3307    /// let x = ListExamplesResponse::new().set_next_page_token("example");
3308    /// ```
3309    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3310        self.next_page_token = v.into();
3311        self
3312    }
3313}
3314
3315impl wkt::message::Message for ListExamplesResponse {
3316    fn typename() -> &'static str {
3317        "type.googleapis.com/google.cloud.translation.v3.ListExamplesResponse"
3318    }
3319}
3320
3321#[doc(hidden)]
3322impl google_cloud_gax::paginator::internal::PageableResponse for ListExamplesResponse {
3323    type PageItem = crate::model::Example;
3324
3325    fn items(self) -> std::vec::Vec<Self::PageItem> {
3326        self.examples
3327    }
3328
3329    fn next_page_token(&self) -> std::string::String {
3330        use std::clone::Clone;
3331        self.next_page_token.clone()
3332    }
3333}
3334
3335/// A sentence pair.
3336#[derive(Clone, Default, PartialEq)]
3337#[non_exhaustive]
3338pub struct Example {
3339    /// Output only. The resource name of the example, in form of
3340    /// `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}/examples/{example_id}`
3341    pub name: std::string::String,
3342
3343    /// Sentence in source language.
3344    pub source_text: std::string::String,
3345
3346    /// Sentence in target language.
3347    pub target_text: std::string::String,
3348
3349    /// Output only. Usage of the sentence pair. Options are TRAIN|VALIDATION|TEST.
3350    pub usage: std::string::String,
3351
3352    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3353}
3354
3355impl Example {
3356    pub fn new() -> Self {
3357        std::default::Default::default()
3358    }
3359
3360    /// Sets the value of [name][crate::model::Example::name].
3361    ///
3362    /// # Example
3363    /// ```ignore,no_run
3364    /// # use google_cloud_translation_v3::model::Example;
3365    /// let x = Example::new().set_name("example");
3366    /// ```
3367    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3368        self.name = v.into();
3369        self
3370    }
3371
3372    /// Sets the value of [source_text][crate::model::Example::source_text].
3373    ///
3374    /// # Example
3375    /// ```ignore,no_run
3376    /// # use google_cloud_translation_v3::model::Example;
3377    /// let x = Example::new().set_source_text("example");
3378    /// ```
3379    pub fn set_source_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3380        self.source_text = v.into();
3381        self
3382    }
3383
3384    /// Sets the value of [target_text][crate::model::Example::target_text].
3385    ///
3386    /// # Example
3387    /// ```ignore,no_run
3388    /// # use google_cloud_translation_v3::model::Example;
3389    /// let x = Example::new().set_target_text("example");
3390    /// ```
3391    pub fn set_target_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3392        self.target_text = v.into();
3393        self
3394    }
3395
3396    /// Sets the value of [usage][crate::model::Example::usage].
3397    ///
3398    /// # Example
3399    /// ```ignore,no_run
3400    /// # use google_cloud_translation_v3::model::Example;
3401    /// let x = Example::new().set_usage("example");
3402    /// ```
3403    pub fn set_usage<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3404        self.usage = v.into();
3405        self
3406    }
3407}
3408
3409impl wkt::message::Message for Example {
3410    fn typename() -> &'static str {
3411        "type.googleapis.com/google.cloud.translation.v3.Example"
3412    }
3413}
3414
3415/// Response message for BatchTransferResources.
3416#[derive(Clone, Default, PartialEq)]
3417#[non_exhaustive]
3418pub struct BatchTransferResourcesResponse {
3419    /// Responses of the transfer for individual resources.
3420    pub responses:
3421        std::vec::Vec<crate::model::batch_transfer_resources_response::TransferResourceResponse>,
3422
3423    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3424}
3425
3426impl BatchTransferResourcesResponse {
3427    pub fn new() -> Self {
3428        std::default::Default::default()
3429    }
3430
3431    /// Sets the value of [responses][crate::model::BatchTransferResourcesResponse::responses].
3432    ///
3433    /// # Example
3434    /// ```ignore,no_run
3435    /// # use google_cloud_translation_v3::model::BatchTransferResourcesResponse;
3436    /// use google_cloud_translation_v3::model::batch_transfer_resources_response::TransferResourceResponse;
3437    /// let x = BatchTransferResourcesResponse::new()
3438    ///     .set_responses([
3439    ///         TransferResourceResponse::default()/* use setters */,
3440    ///         TransferResourceResponse::default()/* use (different) setters */,
3441    ///     ]);
3442    /// ```
3443    pub fn set_responses<T, V>(mut self, v: T) -> Self
3444    where
3445        T: std::iter::IntoIterator<Item = V>,
3446        V: std::convert::Into<
3447                crate::model::batch_transfer_resources_response::TransferResourceResponse,
3448            >,
3449    {
3450        use std::iter::Iterator;
3451        self.responses = v.into_iter().map(|i| i.into()).collect();
3452        self
3453    }
3454}
3455
3456impl wkt::message::Message for BatchTransferResourcesResponse {
3457    fn typename() -> &'static str {
3458        "type.googleapis.com/google.cloud.translation.v3.BatchTransferResourcesResponse"
3459    }
3460}
3461
3462/// Defines additional types related to [BatchTransferResourcesResponse].
3463pub mod batch_transfer_resources_response {
3464    #[allow(unused_imports)]
3465    use super::*;
3466
3467    /// Transfer response for a single resource.
3468    #[derive(Clone, Default, PartialEq)]
3469    #[non_exhaustive]
3470    pub struct TransferResourceResponse {
3471        /// Full name of the resource to transfer as specified in the request.
3472        pub source: std::string::String,
3473
3474        /// Full name of the new resource successfully transferred from the source
3475        /// hosted by Translation API. Target will be empty if the transfer failed.
3476        pub target: std::string::String,
3477
3478        /// The error result in case of failure.
3479        pub error: std::option::Option<google_cloud_rpc::model::Status>,
3480
3481        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3482    }
3483
3484    impl TransferResourceResponse {
3485        pub fn new() -> Self {
3486            std::default::Default::default()
3487        }
3488
3489        /// Sets the value of [source][crate::model::batch_transfer_resources_response::TransferResourceResponse::source].
3490        ///
3491        /// # Example
3492        /// ```ignore,no_run
3493        /// # use google_cloud_translation_v3::model::batch_transfer_resources_response::TransferResourceResponse;
3494        /// let x = TransferResourceResponse::new().set_source("example");
3495        /// ```
3496        pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3497            self.source = v.into();
3498            self
3499        }
3500
3501        /// Sets the value of [target][crate::model::batch_transfer_resources_response::TransferResourceResponse::target].
3502        ///
3503        /// # Example
3504        /// ```ignore,no_run
3505        /// # use google_cloud_translation_v3::model::batch_transfer_resources_response::TransferResourceResponse;
3506        /// let x = TransferResourceResponse::new().set_target("example");
3507        /// ```
3508        pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3509            self.target = v.into();
3510            self
3511        }
3512
3513        /// Sets the value of [error][crate::model::batch_transfer_resources_response::TransferResourceResponse::error].
3514        ///
3515        /// # Example
3516        /// ```ignore,no_run
3517        /// # use google_cloud_translation_v3::model::batch_transfer_resources_response::TransferResourceResponse;
3518        /// use google_cloud_rpc::model::Status;
3519        /// let x = TransferResourceResponse::new().set_error(Status::default()/* use setters */);
3520        /// ```
3521        pub fn set_error<T>(mut self, v: T) -> Self
3522        where
3523            T: std::convert::Into<google_cloud_rpc::model::Status>,
3524        {
3525            self.error = std::option::Option::Some(v.into());
3526            self
3527        }
3528
3529        /// Sets or clears the value of [error][crate::model::batch_transfer_resources_response::TransferResourceResponse::error].
3530        ///
3531        /// # Example
3532        /// ```ignore,no_run
3533        /// # use google_cloud_translation_v3::model::batch_transfer_resources_response::TransferResourceResponse;
3534        /// use google_cloud_rpc::model::Status;
3535        /// let x = TransferResourceResponse::new().set_or_clear_error(Some(Status::default()/* use setters */));
3536        /// let x = TransferResourceResponse::new().set_or_clear_error(None::<Status>);
3537        /// ```
3538        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
3539        where
3540            T: std::convert::Into<google_cloud_rpc::model::Status>,
3541        {
3542            self.error = v.map(|x| x.into());
3543            self
3544        }
3545    }
3546
3547    impl wkt::message::Message for TransferResourceResponse {
3548        fn typename() -> &'static str {
3549            "type.googleapis.com/google.cloud.translation.v3.BatchTransferResourcesResponse.TransferResourceResponse"
3550        }
3551    }
3552}
3553
3554/// A dataset that hosts the examples (sentence pairs) used for translation
3555/// models.
3556#[derive(Clone, Default, PartialEq)]
3557#[non_exhaustive]
3558pub struct Dataset {
3559    /// The resource name of the dataset, in form of
3560    /// `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}`
3561    pub name: std::string::String,
3562
3563    /// The name of the dataset to show in the interface. The name can be
3564    /// up to 32 characters long and can consist only of ASCII Latin letters A-Z
3565    /// and a-z, underscores (_), and ASCII digits 0-9.
3566    pub display_name: std::string::String,
3567
3568    /// The BCP-47 language code of the source language.
3569    pub source_language_code: std::string::String,
3570
3571    /// The BCP-47 language code of the target language.
3572    pub target_language_code: std::string::String,
3573
3574    /// Output only. The number of examples in the dataset.
3575    pub example_count: i32,
3576
3577    /// Output only. Number of training examples (sentence pairs).
3578    pub train_example_count: i32,
3579
3580    /// Output only. Number of validation examples (sentence pairs).
3581    pub validate_example_count: i32,
3582
3583    /// Output only. Number of test examples (sentence pairs).
3584    pub test_example_count: i32,
3585
3586    /// Output only. Timestamp when this dataset was created.
3587    pub create_time: std::option::Option<wkt::Timestamp>,
3588
3589    /// Output only. Timestamp when this dataset was last updated.
3590    pub update_time: std::option::Option<wkt::Timestamp>,
3591
3592    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3593}
3594
3595impl Dataset {
3596    pub fn new() -> Self {
3597        std::default::Default::default()
3598    }
3599
3600    /// Sets the value of [name][crate::model::Dataset::name].
3601    ///
3602    /// # Example
3603    /// ```ignore,no_run
3604    /// # use google_cloud_translation_v3::model::Dataset;
3605    /// let x = Dataset::new().set_name("example");
3606    /// ```
3607    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3608        self.name = v.into();
3609        self
3610    }
3611
3612    /// Sets the value of [display_name][crate::model::Dataset::display_name].
3613    ///
3614    /// # Example
3615    /// ```ignore,no_run
3616    /// # use google_cloud_translation_v3::model::Dataset;
3617    /// let x = Dataset::new().set_display_name("example");
3618    /// ```
3619    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3620        self.display_name = v.into();
3621        self
3622    }
3623
3624    /// Sets the value of [source_language_code][crate::model::Dataset::source_language_code].
3625    ///
3626    /// # Example
3627    /// ```ignore,no_run
3628    /// # use google_cloud_translation_v3::model::Dataset;
3629    /// let x = Dataset::new().set_source_language_code("example");
3630    /// ```
3631    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
3632        mut self,
3633        v: T,
3634    ) -> Self {
3635        self.source_language_code = v.into();
3636        self
3637    }
3638
3639    /// Sets the value of [target_language_code][crate::model::Dataset::target_language_code].
3640    ///
3641    /// # Example
3642    /// ```ignore,no_run
3643    /// # use google_cloud_translation_v3::model::Dataset;
3644    /// let x = Dataset::new().set_target_language_code("example");
3645    /// ```
3646    pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
3647        mut self,
3648        v: T,
3649    ) -> Self {
3650        self.target_language_code = v.into();
3651        self
3652    }
3653
3654    /// Sets the value of [example_count][crate::model::Dataset::example_count].
3655    ///
3656    /// # Example
3657    /// ```ignore,no_run
3658    /// # use google_cloud_translation_v3::model::Dataset;
3659    /// let x = Dataset::new().set_example_count(42);
3660    /// ```
3661    pub fn set_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3662        self.example_count = v.into();
3663        self
3664    }
3665
3666    /// Sets the value of [train_example_count][crate::model::Dataset::train_example_count].
3667    ///
3668    /// # Example
3669    /// ```ignore,no_run
3670    /// # use google_cloud_translation_v3::model::Dataset;
3671    /// let x = Dataset::new().set_train_example_count(42);
3672    /// ```
3673    pub fn set_train_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3674        self.train_example_count = v.into();
3675        self
3676    }
3677
3678    /// Sets the value of [validate_example_count][crate::model::Dataset::validate_example_count].
3679    ///
3680    /// # Example
3681    /// ```ignore,no_run
3682    /// # use google_cloud_translation_v3::model::Dataset;
3683    /// let x = Dataset::new().set_validate_example_count(42);
3684    /// ```
3685    pub fn set_validate_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3686        self.validate_example_count = v.into();
3687        self
3688    }
3689
3690    /// Sets the value of [test_example_count][crate::model::Dataset::test_example_count].
3691    ///
3692    /// # Example
3693    /// ```ignore,no_run
3694    /// # use google_cloud_translation_v3::model::Dataset;
3695    /// let x = Dataset::new().set_test_example_count(42);
3696    /// ```
3697    pub fn set_test_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3698        self.test_example_count = v.into();
3699        self
3700    }
3701
3702    /// Sets the value of [create_time][crate::model::Dataset::create_time].
3703    ///
3704    /// # Example
3705    /// ```ignore,no_run
3706    /// # use google_cloud_translation_v3::model::Dataset;
3707    /// use wkt::Timestamp;
3708    /// let x = Dataset::new().set_create_time(Timestamp::default()/* use setters */);
3709    /// ```
3710    pub fn set_create_time<T>(mut self, v: T) -> Self
3711    where
3712        T: std::convert::Into<wkt::Timestamp>,
3713    {
3714        self.create_time = std::option::Option::Some(v.into());
3715        self
3716    }
3717
3718    /// Sets or clears the value of [create_time][crate::model::Dataset::create_time].
3719    ///
3720    /// # Example
3721    /// ```ignore,no_run
3722    /// # use google_cloud_translation_v3::model::Dataset;
3723    /// use wkt::Timestamp;
3724    /// let x = Dataset::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3725    /// let x = Dataset::new().set_or_clear_create_time(None::<Timestamp>);
3726    /// ```
3727    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3728    where
3729        T: std::convert::Into<wkt::Timestamp>,
3730    {
3731        self.create_time = v.map(|x| x.into());
3732        self
3733    }
3734
3735    /// Sets the value of [update_time][crate::model::Dataset::update_time].
3736    ///
3737    /// # Example
3738    /// ```ignore,no_run
3739    /// # use google_cloud_translation_v3::model::Dataset;
3740    /// use wkt::Timestamp;
3741    /// let x = Dataset::new().set_update_time(Timestamp::default()/* use setters */);
3742    /// ```
3743    pub fn set_update_time<T>(mut self, v: T) -> Self
3744    where
3745        T: std::convert::Into<wkt::Timestamp>,
3746    {
3747        self.update_time = std::option::Option::Some(v.into());
3748        self
3749    }
3750
3751    /// Sets or clears the value of [update_time][crate::model::Dataset::update_time].
3752    ///
3753    /// # Example
3754    /// ```ignore,no_run
3755    /// # use google_cloud_translation_v3::model::Dataset;
3756    /// use wkt::Timestamp;
3757    /// let x = Dataset::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3758    /// let x = Dataset::new().set_or_clear_update_time(None::<Timestamp>);
3759    /// ```
3760    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3761    where
3762        T: std::convert::Into<wkt::Timestamp>,
3763    {
3764        self.update_time = v.map(|x| x.into());
3765        self
3766    }
3767}
3768
3769impl wkt::message::Message for Dataset {
3770    fn typename() -> &'static str {
3771        "type.googleapis.com/google.cloud.translation.v3.Dataset"
3772    }
3773}
3774
3775/// Request message for CreateModel.
3776#[derive(Clone, Default, PartialEq)]
3777#[non_exhaustive]
3778pub struct CreateModelRequest {
3779    /// Required. The project name, in form of
3780    /// `projects/{project}/locations/{location}`
3781    pub parent: std::string::String,
3782
3783    /// Required. The Model to create.
3784    pub model: std::option::Option<crate::model::Model>,
3785
3786    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3787}
3788
3789impl CreateModelRequest {
3790    pub fn new() -> Self {
3791        std::default::Default::default()
3792    }
3793
3794    /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
3795    ///
3796    /// # Example
3797    /// ```ignore,no_run
3798    /// # use google_cloud_translation_v3::model::CreateModelRequest;
3799    /// let x = CreateModelRequest::new().set_parent("example");
3800    /// ```
3801    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3802        self.parent = v.into();
3803        self
3804    }
3805
3806    /// Sets the value of [model][crate::model::CreateModelRequest::model].
3807    ///
3808    /// # Example
3809    /// ```ignore,no_run
3810    /// # use google_cloud_translation_v3::model::CreateModelRequest;
3811    /// use google_cloud_translation_v3::model::Model;
3812    /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
3813    /// ```
3814    pub fn set_model<T>(mut self, v: T) -> Self
3815    where
3816        T: std::convert::Into<crate::model::Model>,
3817    {
3818        self.model = std::option::Option::Some(v.into());
3819        self
3820    }
3821
3822    /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
3823    ///
3824    /// # Example
3825    /// ```ignore,no_run
3826    /// # use google_cloud_translation_v3::model::CreateModelRequest;
3827    /// use google_cloud_translation_v3::model::Model;
3828    /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
3829    /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
3830    /// ```
3831    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3832    where
3833        T: std::convert::Into<crate::model::Model>,
3834    {
3835        self.model = v.map(|x| x.into());
3836        self
3837    }
3838}
3839
3840impl wkt::message::Message for CreateModelRequest {
3841    fn typename() -> &'static str {
3842        "type.googleapis.com/google.cloud.translation.v3.CreateModelRequest"
3843    }
3844}
3845
3846/// Metadata of create model operation.
3847#[derive(Clone, Default, PartialEq)]
3848#[non_exhaustive]
3849pub struct CreateModelMetadata {
3850    /// The current state of the operation.
3851    pub state: crate::model::OperationState,
3852
3853    /// The creation time of the operation.
3854    pub create_time: std::option::Option<wkt::Timestamp>,
3855
3856    /// The last update time of the operation.
3857    pub update_time: std::option::Option<wkt::Timestamp>,
3858
3859    /// Only populated when operation doesn't succeed.
3860    pub error: std::option::Option<google_cloud_rpc::model::Status>,
3861
3862    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3863}
3864
3865impl CreateModelMetadata {
3866    pub fn new() -> Self {
3867        std::default::Default::default()
3868    }
3869
3870    /// Sets the value of [state][crate::model::CreateModelMetadata::state].
3871    ///
3872    /// # Example
3873    /// ```ignore,no_run
3874    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3875    /// use google_cloud_translation_v3::model::OperationState;
3876    /// let x0 = CreateModelMetadata::new().set_state(OperationState::Running);
3877    /// let x1 = CreateModelMetadata::new().set_state(OperationState::Succeeded);
3878    /// let x2 = CreateModelMetadata::new().set_state(OperationState::Failed);
3879    /// ```
3880    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
3881        self.state = v.into();
3882        self
3883    }
3884
3885    /// Sets the value of [create_time][crate::model::CreateModelMetadata::create_time].
3886    ///
3887    /// # Example
3888    /// ```ignore,no_run
3889    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3890    /// use wkt::Timestamp;
3891    /// let x = CreateModelMetadata::new().set_create_time(Timestamp::default()/* use setters */);
3892    /// ```
3893    pub fn set_create_time<T>(mut self, v: T) -> Self
3894    where
3895        T: std::convert::Into<wkt::Timestamp>,
3896    {
3897        self.create_time = std::option::Option::Some(v.into());
3898        self
3899    }
3900
3901    /// Sets or clears the value of [create_time][crate::model::CreateModelMetadata::create_time].
3902    ///
3903    /// # Example
3904    /// ```ignore,no_run
3905    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3906    /// use wkt::Timestamp;
3907    /// let x = CreateModelMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3908    /// let x = CreateModelMetadata::new().set_or_clear_create_time(None::<Timestamp>);
3909    /// ```
3910    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3911    where
3912        T: std::convert::Into<wkt::Timestamp>,
3913    {
3914        self.create_time = v.map(|x| x.into());
3915        self
3916    }
3917
3918    /// Sets the value of [update_time][crate::model::CreateModelMetadata::update_time].
3919    ///
3920    /// # Example
3921    /// ```ignore,no_run
3922    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3923    /// use wkt::Timestamp;
3924    /// let x = CreateModelMetadata::new().set_update_time(Timestamp::default()/* use setters */);
3925    /// ```
3926    pub fn set_update_time<T>(mut self, v: T) -> Self
3927    where
3928        T: std::convert::Into<wkt::Timestamp>,
3929    {
3930        self.update_time = std::option::Option::Some(v.into());
3931        self
3932    }
3933
3934    /// Sets or clears the value of [update_time][crate::model::CreateModelMetadata::update_time].
3935    ///
3936    /// # Example
3937    /// ```ignore,no_run
3938    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3939    /// use wkt::Timestamp;
3940    /// let x = CreateModelMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3941    /// let x = CreateModelMetadata::new().set_or_clear_update_time(None::<Timestamp>);
3942    /// ```
3943    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3944    where
3945        T: std::convert::Into<wkt::Timestamp>,
3946    {
3947        self.update_time = v.map(|x| x.into());
3948        self
3949    }
3950
3951    /// Sets the value of [error][crate::model::CreateModelMetadata::error].
3952    ///
3953    /// # Example
3954    /// ```ignore,no_run
3955    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3956    /// use google_cloud_rpc::model::Status;
3957    /// let x = CreateModelMetadata::new().set_error(Status::default()/* use setters */);
3958    /// ```
3959    pub fn set_error<T>(mut self, v: T) -> Self
3960    where
3961        T: std::convert::Into<google_cloud_rpc::model::Status>,
3962    {
3963        self.error = std::option::Option::Some(v.into());
3964        self
3965    }
3966
3967    /// Sets or clears the value of [error][crate::model::CreateModelMetadata::error].
3968    ///
3969    /// # Example
3970    /// ```ignore,no_run
3971    /// # use google_cloud_translation_v3::model::CreateModelMetadata;
3972    /// use google_cloud_rpc::model::Status;
3973    /// let x = CreateModelMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
3974    /// let x = CreateModelMetadata::new().set_or_clear_error(None::<Status>);
3975    /// ```
3976    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
3977    where
3978        T: std::convert::Into<google_cloud_rpc::model::Status>,
3979    {
3980        self.error = v.map(|x| x.into());
3981        self
3982    }
3983}
3984
3985impl wkt::message::Message for CreateModelMetadata {
3986    fn typename() -> &'static str {
3987        "type.googleapis.com/google.cloud.translation.v3.CreateModelMetadata"
3988    }
3989}
3990
3991/// Request message for ListModels.
3992#[derive(Clone, Default, PartialEq)]
3993#[non_exhaustive]
3994pub struct ListModelsRequest {
3995    /// Required. Name of the parent project. In form of
3996    /// `projects/{project-number-or-id}/locations/{location-id}`
3997    pub parent: std::string::String,
3998
3999    /// Optional. An expression for filtering the models that will be returned.
4000    /// Supported filter:
4001    /// `dataset_id=${dataset_id}`
4002    pub filter: std::string::String,
4003
4004    /// Optional. Requested page size. The server can return fewer results than
4005    /// requested.
4006    pub page_size: i32,
4007
4008    /// Optional. A token identifying a page of results for the server to return.
4009    /// Typically obtained from next_page_token field in the response of a
4010    /// ListModels call.
4011    pub page_token: std::string::String,
4012
4013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4014}
4015
4016impl ListModelsRequest {
4017    pub fn new() -> Self {
4018        std::default::Default::default()
4019    }
4020
4021    /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
4022    ///
4023    /// # Example
4024    /// ```ignore,no_run
4025    /// # use google_cloud_translation_v3::model::ListModelsRequest;
4026    /// let x = ListModelsRequest::new().set_parent("example");
4027    /// ```
4028    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4029        self.parent = v.into();
4030        self
4031    }
4032
4033    /// Sets the value of [filter][crate::model::ListModelsRequest::filter].
4034    ///
4035    /// # Example
4036    /// ```ignore,no_run
4037    /// # use google_cloud_translation_v3::model::ListModelsRequest;
4038    /// let x = ListModelsRequest::new().set_filter("example");
4039    /// ```
4040    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4041        self.filter = v.into();
4042        self
4043    }
4044
4045    /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
4046    ///
4047    /// # Example
4048    /// ```ignore,no_run
4049    /// # use google_cloud_translation_v3::model::ListModelsRequest;
4050    /// let x = ListModelsRequest::new().set_page_size(42);
4051    /// ```
4052    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4053        self.page_size = v.into();
4054        self
4055    }
4056
4057    /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
4058    ///
4059    /// # Example
4060    /// ```ignore,no_run
4061    /// # use google_cloud_translation_v3::model::ListModelsRequest;
4062    /// let x = ListModelsRequest::new().set_page_token("example");
4063    /// ```
4064    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4065        self.page_token = v.into();
4066        self
4067    }
4068}
4069
4070impl wkt::message::Message for ListModelsRequest {
4071    fn typename() -> &'static str {
4072        "type.googleapis.com/google.cloud.translation.v3.ListModelsRequest"
4073    }
4074}
4075
4076/// Response message for ListModels.
4077#[derive(Clone, Default, PartialEq)]
4078#[non_exhaustive]
4079pub struct ListModelsResponse {
4080    /// The models read.
4081    pub models: std::vec::Vec<crate::model::Model>,
4082
4083    /// A token to retrieve next page of results.
4084    /// Pass this token to the page_token field in the ListModelsRequest to
4085    /// obtain the corresponding page.
4086    pub next_page_token: std::string::String,
4087
4088    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4089}
4090
4091impl ListModelsResponse {
4092    pub fn new() -> Self {
4093        std::default::Default::default()
4094    }
4095
4096    /// Sets the value of [models][crate::model::ListModelsResponse::models].
4097    ///
4098    /// # Example
4099    /// ```ignore,no_run
4100    /// # use google_cloud_translation_v3::model::ListModelsResponse;
4101    /// use google_cloud_translation_v3::model::Model;
4102    /// let x = ListModelsResponse::new()
4103    ///     .set_models([
4104    ///         Model::default()/* use setters */,
4105    ///         Model::default()/* use (different) setters */,
4106    ///     ]);
4107    /// ```
4108    pub fn set_models<T, V>(mut self, v: T) -> Self
4109    where
4110        T: std::iter::IntoIterator<Item = V>,
4111        V: std::convert::Into<crate::model::Model>,
4112    {
4113        use std::iter::Iterator;
4114        self.models = v.into_iter().map(|i| i.into()).collect();
4115        self
4116    }
4117
4118    /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
4119    ///
4120    /// # Example
4121    /// ```ignore,no_run
4122    /// # use google_cloud_translation_v3::model::ListModelsResponse;
4123    /// let x = ListModelsResponse::new().set_next_page_token("example");
4124    /// ```
4125    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4126        self.next_page_token = v.into();
4127        self
4128    }
4129}
4130
4131impl wkt::message::Message for ListModelsResponse {
4132    fn typename() -> &'static str {
4133        "type.googleapis.com/google.cloud.translation.v3.ListModelsResponse"
4134    }
4135}
4136
4137#[doc(hidden)]
4138impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
4139    type PageItem = crate::model::Model;
4140
4141    fn items(self) -> std::vec::Vec<Self::PageItem> {
4142        self.models
4143    }
4144
4145    fn next_page_token(&self) -> std::string::String {
4146        use std::clone::Clone;
4147        self.next_page_token.clone()
4148    }
4149}
4150
4151/// Request message for GetModel.
4152#[derive(Clone, Default, PartialEq)]
4153#[non_exhaustive]
4154pub struct GetModelRequest {
4155    /// Required. The resource name of the model to retrieve.
4156    pub name: std::string::String,
4157
4158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4159}
4160
4161impl GetModelRequest {
4162    pub fn new() -> Self {
4163        std::default::Default::default()
4164    }
4165
4166    /// Sets the value of [name][crate::model::GetModelRequest::name].
4167    ///
4168    /// # Example
4169    /// ```ignore,no_run
4170    /// # use google_cloud_translation_v3::model::GetModelRequest;
4171    /// let x = GetModelRequest::new().set_name("example");
4172    /// ```
4173    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174        self.name = v.into();
4175        self
4176    }
4177}
4178
4179impl wkt::message::Message for GetModelRequest {
4180    fn typename() -> &'static str {
4181        "type.googleapis.com/google.cloud.translation.v3.GetModelRequest"
4182    }
4183}
4184
4185/// Request message for DeleteModel.
4186#[derive(Clone, Default, PartialEq)]
4187#[non_exhaustive]
4188pub struct DeleteModelRequest {
4189    /// Required. The name of the model to delete.
4190    pub name: std::string::String,
4191
4192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4193}
4194
4195impl DeleteModelRequest {
4196    pub fn new() -> Self {
4197        std::default::Default::default()
4198    }
4199
4200    /// Sets the value of [name][crate::model::DeleteModelRequest::name].
4201    ///
4202    /// # Example
4203    /// ```ignore,no_run
4204    /// # use google_cloud_translation_v3::model::DeleteModelRequest;
4205    /// let x = DeleteModelRequest::new().set_name("example");
4206    /// ```
4207    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4208        self.name = v.into();
4209        self
4210    }
4211}
4212
4213impl wkt::message::Message for DeleteModelRequest {
4214    fn typename() -> &'static str {
4215        "type.googleapis.com/google.cloud.translation.v3.DeleteModelRequest"
4216    }
4217}
4218
4219/// Metadata of delete model operation.
4220#[derive(Clone, Default, PartialEq)]
4221#[non_exhaustive]
4222pub struct DeleteModelMetadata {
4223    /// The current state of the operation.
4224    pub state: crate::model::OperationState,
4225
4226    /// The creation time of the operation.
4227    pub create_time: std::option::Option<wkt::Timestamp>,
4228
4229    /// The last update time of the operation.
4230    pub update_time: std::option::Option<wkt::Timestamp>,
4231
4232    /// Only populated when operation doesn't succeed.
4233    pub error: std::option::Option<google_cloud_rpc::model::Status>,
4234
4235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4236}
4237
4238impl DeleteModelMetadata {
4239    pub fn new() -> Self {
4240        std::default::Default::default()
4241    }
4242
4243    /// Sets the value of [state][crate::model::DeleteModelMetadata::state].
4244    ///
4245    /// # Example
4246    /// ```ignore,no_run
4247    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4248    /// use google_cloud_translation_v3::model::OperationState;
4249    /// let x0 = DeleteModelMetadata::new().set_state(OperationState::Running);
4250    /// let x1 = DeleteModelMetadata::new().set_state(OperationState::Succeeded);
4251    /// let x2 = DeleteModelMetadata::new().set_state(OperationState::Failed);
4252    /// ```
4253    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
4254        self.state = v.into();
4255        self
4256    }
4257
4258    /// Sets the value of [create_time][crate::model::DeleteModelMetadata::create_time].
4259    ///
4260    /// # Example
4261    /// ```ignore,no_run
4262    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4263    /// use wkt::Timestamp;
4264    /// let x = DeleteModelMetadata::new().set_create_time(Timestamp::default()/* use setters */);
4265    /// ```
4266    pub fn set_create_time<T>(mut self, v: T) -> Self
4267    where
4268        T: std::convert::Into<wkt::Timestamp>,
4269    {
4270        self.create_time = std::option::Option::Some(v.into());
4271        self
4272    }
4273
4274    /// Sets or clears the value of [create_time][crate::model::DeleteModelMetadata::create_time].
4275    ///
4276    /// # Example
4277    /// ```ignore,no_run
4278    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4279    /// use wkt::Timestamp;
4280    /// let x = DeleteModelMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4281    /// let x = DeleteModelMetadata::new().set_or_clear_create_time(None::<Timestamp>);
4282    /// ```
4283    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4284    where
4285        T: std::convert::Into<wkt::Timestamp>,
4286    {
4287        self.create_time = v.map(|x| x.into());
4288        self
4289    }
4290
4291    /// Sets the value of [update_time][crate::model::DeleteModelMetadata::update_time].
4292    ///
4293    /// # Example
4294    /// ```ignore,no_run
4295    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4296    /// use wkt::Timestamp;
4297    /// let x = DeleteModelMetadata::new().set_update_time(Timestamp::default()/* use setters */);
4298    /// ```
4299    pub fn set_update_time<T>(mut self, v: T) -> Self
4300    where
4301        T: std::convert::Into<wkt::Timestamp>,
4302    {
4303        self.update_time = std::option::Option::Some(v.into());
4304        self
4305    }
4306
4307    /// Sets or clears the value of [update_time][crate::model::DeleteModelMetadata::update_time].
4308    ///
4309    /// # Example
4310    /// ```ignore,no_run
4311    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4312    /// use wkt::Timestamp;
4313    /// let x = DeleteModelMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4314    /// let x = DeleteModelMetadata::new().set_or_clear_update_time(None::<Timestamp>);
4315    /// ```
4316    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4317    where
4318        T: std::convert::Into<wkt::Timestamp>,
4319    {
4320        self.update_time = v.map(|x| x.into());
4321        self
4322    }
4323
4324    /// Sets the value of [error][crate::model::DeleteModelMetadata::error].
4325    ///
4326    /// # Example
4327    /// ```ignore,no_run
4328    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4329    /// use google_cloud_rpc::model::Status;
4330    /// let x = DeleteModelMetadata::new().set_error(Status::default()/* use setters */);
4331    /// ```
4332    pub fn set_error<T>(mut self, v: T) -> Self
4333    where
4334        T: std::convert::Into<google_cloud_rpc::model::Status>,
4335    {
4336        self.error = std::option::Option::Some(v.into());
4337        self
4338    }
4339
4340    /// Sets or clears the value of [error][crate::model::DeleteModelMetadata::error].
4341    ///
4342    /// # Example
4343    /// ```ignore,no_run
4344    /// # use google_cloud_translation_v3::model::DeleteModelMetadata;
4345    /// use google_cloud_rpc::model::Status;
4346    /// let x = DeleteModelMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
4347    /// let x = DeleteModelMetadata::new().set_or_clear_error(None::<Status>);
4348    /// ```
4349    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
4350    where
4351        T: std::convert::Into<google_cloud_rpc::model::Status>,
4352    {
4353        self.error = v.map(|x| x.into());
4354        self
4355    }
4356}
4357
4358impl wkt::message::Message for DeleteModelMetadata {
4359    fn typename() -> &'static str {
4360        "type.googleapis.com/google.cloud.translation.v3.DeleteModelMetadata"
4361    }
4362}
4363
4364/// A trained translation model.
4365#[derive(Clone, Default, PartialEq)]
4366#[non_exhaustive]
4367pub struct Model {
4368    /// The resource name of the model, in form of
4369    /// `projects/{project-number-or-id}/locations/{location_id}/models/{model_id}`
4370    pub name: std::string::String,
4371
4372    /// The name of the model to show in the interface. The name can be
4373    /// up to 32 characters long and can consist only of ASCII Latin letters A-Z
4374    /// and a-z, underscores (_), and ASCII digits 0-9.
4375    pub display_name: std::string::String,
4376
4377    /// The dataset from which the model is trained, in form of
4378    /// `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}`
4379    pub dataset: std::string::String,
4380
4381    /// Output only. The BCP-47 language code of the source language.
4382    pub source_language_code: std::string::String,
4383
4384    /// Output only. The BCP-47 language code of the target language.
4385    pub target_language_code: std::string::String,
4386
4387    /// Output only. Number of examples (sentence pairs) used to train the model.
4388    pub train_example_count: i32,
4389
4390    /// Output only. Number of examples (sentence pairs) used to validate the
4391    /// model.
4392    pub validate_example_count: i32,
4393
4394    /// Output only. Number of examples (sentence pairs) used to test the model.
4395    pub test_example_count: i32,
4396
4397    /// Output only. Timestamp when the model resource was created, which is also
4398    /// when the training started.
4399    pub create_time: std::option::Option<wkt::Timestamp>,
4400
4401    /// Output only. Timestamp when this model was last updated.
4402    pub update_time: std::option::Option<wkt::Timestamp>,
4403
4404    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4405}
4406
4407impl Model {
4408    pub fn new() -> Self {
4409        std::default::Default::default()
4410    }
4411
4412    /// Sets the value of [name][crate::model::Model::name].
4413    ///
4414    /// # Example
4415    /// ```ignore,no_run
4416    /// # use google_cloud_translation_v3::model::Model;
4417    /// let x = Model::new().set_name("example");
4418    /// ```
4419    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4420        self.name = v.into();
4421        self
4422    }
4423
4424    /// Sets the value of [display_name][crate::model::Model::display_name].
4425    ///
4426    /// # Example
4427    /// ```ignore,no_run
4428    /// # use google_cloud_translation_v3::model::Model;
4429    /// let x = Model::new().set_display_name("example");
4430    /// ```
4431    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4432        self.display_name = v.into();
4433        self
4434    }
4435
4436    /// Sets the value of [dataset][crate::model::Model::dataset].
4437    ///
4438    /// # Example
4439    /// ```ignore,no_run
4440    /// # use google_cloud_translation_v3::model::Model;
4441    /// let x = Model::new().set_dataset("example");
4442    /// ```
4443    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4444        self.dataset = v.into();
4445        self
4446    }
4447
4448    /// Sets the value of [source_language_code][crate::model::Model::source_language_code].
4449    ///
4450    /// # Example
4451    /// ```ignore,no_run
4452    /// # use google_cloud_translation_v3::model::Model;
4453    /// let x = Model::new().set_source_language_code("example");
4454    /// ```
4455    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
4456        mut self,
4457        v: T,
4458    ) -> Self {
4459        self.source_language_code = v.into();
4460        self
4461    }
4462
4463    /// Sets the value of [target_language_code][crate::model::Model::target_language_code].
4464    ///
4465    /// # Example
4466    /// ```ignore,no_run
4467    /// # use google_cloud_translation_v3::model::Model;
4468    /// let x = Model::new().set_target_language_code("example");
4469    /// ```
4470    pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
4471        mut self,
4472        v: T,
4473    ) -> Self {
4474        self.target_language_code = v.into();
4475        self
4476    }
4477
4478    /// Sets the value of [train_example_count][crate::model::Model::train_example_count].
4479    ///
4480    /// # Example
4481    /// ```ignore,no_run
4482    /// # use google_cloud_translation_v3::model::Model;
4483    /// let x = Model::new().set_train_example_count(42);
4484    /// ```
4485    pub fn set_train_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4486        self.train_example_count = v.into();
4487        self
4488    }
4489
4490    /// Sets the value of [validate_example_count][crate::model::Model::validate_example_count].
4491    ///
4492    /// # Example
4493    /// ```ignore,no_run
4494    /// # use google_cloud_translation_v3::model::Model;
4495    /// let x = Model::new().set_validate_example_count(42);
4496    /// ```
4497    pub fn set_validate_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4498        self.validate_example_count = v.into();
4499        self
4500    }
4501
4502    /// Sets the value of [test_example_count][crate::model::Model::test_example_count].
4503    ///
4504    /// # Example
4505    /// ```ignore,no_run
4506    /// # use google_cloud_translation_v3::model::Model;
4507    /// let x = Model::new().set_test_example_count(42);
4508    /// ```
4509    pub fn set_test_example_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4510        self.test_example_count = v.into();
4511        self
4512    }
4513
4514    /// Sets the value of [create_time][crate::model::Model::create_time].
4515    ///
4516    /// # Example
4517    /// ```ignore,no_run
4518    /// # use google_cloud_translation_v3::model::Model;
4519    /// use wkt::Timestamp;
4520    /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
4521    /// ```
4522    pub fn set_create_time<T>(mut self, v: T) -> Self
4523    where
4524        T: std::convert::Into<wkt::Timestamp>,
4525    {
4526        self.create_time = std::option::Option::Some(v.into());
4527        self
4528    }
4529
4530    /// Sets or clears the value of [create_time][crate::model::Model::create_time].
4531    ///
4532    /// # Example
4533    /// ```ignore,no_run
4534    /// # use google_cloud_translation_v3::model::Model;
4535    /// use wkt::Timestamp;
4536    /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4537    /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
4538    /// ```
4539    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4540    where
4541        T: std::convert::Into<wkt::Timestamp>,
4542    {
4543        self.create_time = v.map(|x| x.into());
4544        self
4545    }
4546
4547    /// Sets the value of [update_time][crate::model::Model::update_time].
4548    ///
4549    /// # Example
4550    /// ```ignore,no_run
4551    /// # use google_cloud_translation_v3::model::Model;
4552    /// use wkt::Timestamp;
4553    /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
4554    /// ```
4555    pub fn set_update_time<T>(mut self, v: T) -> Self
4556    where
4557        T: std::convert::Into<wkt::Timestamp>,
4558    {
4559        self.update_time = std::option::Option::Some(v.into());
4560        self
4561    }
4562
4563    /// Sets or clears the value of [update_time][crate::model::Model::update_time].
4564    ///
4565    /// # Example
4566    /// ```ignore,no_run
4567    /// # use google_cloud_translation_v3::model::Model;
4568    /// use wkt::Timestamp;
4569    /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4570    /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
4571    /// ```
4572    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4573    where
4574        T: std::convert::Into<wkt::Timestamp>,
4575    {
4576        self.update_time = v.map(|x| x.into());
4577        self
4578    }
4579}
4580
4581impl wkt::message::Message for Model {
4582    fn typename() -> &'static str {
4583        "type.googleapis.com/google.cloud.translation.v3.Model"
4584    }
4585}
4586
4587/// The Google Cloud Storage location for the input content.
4588#[derive(Clone, Default, PartialEq)]
4589#[non_exhaustive]
4590pub struct GcsInputSource {
4591    /// Required. Source data URI. For example, `gs://my_bucket/my_object`.
4592    pub input_uri: std::string::String,
4593
4594    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4595}
4596
4597impl GcsInputSource {
4598    pub fn new() -> Self {
4599        std::default::Default::default()
4600    }
4601
4602    /// Sets the value of [input_uri][crate::model::GcsInputSource::input_uri].
4603    ///
4604    /// # Example
4605    /// ```ignore,no_run
4606    /// # use google_cloud_translation_v3::model::GcsInputSource;
4607    /// let x = GcsInputSource::new().set_input_uri("example");
4608    /// ```
4609    pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4610        self.input_uri = v.into();
4611        self
4612    }
4613}
4614
4615impl wkt::message::Message for GcsInputSource {
4616    fn typename() -> &'static str {
4617        "type.googleapis.com/google.cloud.translation.v3.GcsInputSource"
4618    }
4619}
4620
4621/// An inlined file.
4622#[derive(Clone, Default, PartialEq)]
4623#[non_exhaustive]
4624pub struct FileInputSource {
4625    /// Required. The file's mime type.
4626    pub mime_type: std::string::String,
4627
4628    /// Required. The file's byte contents.
4629    pub content: ::bytes::Bytes,
4630
4631    /// Required. The file's display name.
4632    pub display_name: std::string::String,
4633
4634    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4635}
4636
4637impl FileInputSource {
4638    pub fn new() -> Self {
4639        std::default::Default::default()
4640    }
4641
4642    /// Sets the value of [mime_type][crate::model::FileInputSource::mime_type].
4643    ///
4644    /// # Example
4645    /// ```ignore,no_run
4646    /// # use google_cloud_translation_v3::model::FileInputSource;
4647    /// let x = FileInputSource::new().set_mime_type("example");
4648    /// ```
4649    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4650        self.mime_type = v.into();
4651        self
4652    }
4653
4654    /// Sets the value of [content][crate::model::FileInputSource::content].
4655    ///
4656    /// # Example
4657    /// ```ignore,no_run
4658    /// # use google_cloud_translation_v3::model::FileInputSource;
4659    /// let x = FileInputSource::new().set_content(bytes::Bytes::from_static(b"example"));
4660    /// ```
4661    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4662        self.content = v.into();
4663        self
4664    }
4665
4666    /// Sets the value of [display_name][crate::model::FileInputSource::display_name].
4667    ///
4668    /// # Example
4669    /// ```ignore,no_run
4670    /// # use google_cloud_translation_v3::model::FileInputSource;
4671    /// let x = FileInputSource::new().set_display_name("example");
4672    /// ```
4673    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4674        self.display_name = v.into();
4675        self
4676    }
4677}
4678
4679impl wkt::message::Message for FileInputSource {
4680    fn typename() -> &'static str {
4681        "type.googleapis.com/google.cloud.translation.v3.FileInputSource"
4682    }
4683}
4684
4685/// The Google Cloud Storage location for the output content.
4686#[derive(Clone, Default, PartialEq)]
4687#[non_exhaustive]
4688pub struct GcsOutputDestination {
4689    /// Required. Google Cloud Storage URI to output directory. For example,
4690    /// `gs://bucket/directory`. The requesting user must have write permission to
4691    /// the bucket. The directory will be created if it doesn't exist.
4692    pub output_uri_prefix: std::string::String,
4693
4694    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4695}
4696
4697impl GcsOutputDestination {
4698    pub fn new() -> Self {
4699        std::default::Default::default()
4700    }
4701
4702    /// Sets the value of [output_uri_prefix][crate::model::GcsOutputDestination::output_uri_prefix].
4703    ///
4704    /// # Example
4705    /// ```ignore,no_run
4706    /// # use google_cloud_translation_v3::model::GcsOutputDestination;
4707    /// let x = GcsOutputDestination::new().set_output_uri_prefix("example");
4708    /// ```
4709    pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
4710        mut self,
4711        v: T,
4712    ) -> Self {
4713        self.output_uri_prefix = v.into();
4714        self
4715    }
4716}
4717
4718impl wkt::message::Message for GcsOutputDestination {
4719    fn typename() -> &'static str {
4720        "type.googleapis.com/google.cloud.translation.v3.GcsOutputDestination"
4721    }
4722}
4723
4724/// Represents a single entry in a glossary.
4725#[derive(Clone, Default, PartialEq)]
4726#[non_exhaustive]
4727pub struct GlossaryEntry {
4728    /// Identifier. The resource name of the entry.
4729    /// Format:
4730    /// `projects/*/locations/*/glossaries/*/glossaryEntries/*`
4731    pub name: std::string::String,
4732
4733    /// Describes the glossary entry.
4734    pub description: std::string::String,
4735
4736    /// The different data for the glossary types (Unidirectional, Equivalent term
4737    /// sets).
4738    pub data: std::option::Option<crate::model::glossary_entry::Data>,
4739
4740    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4741}
4742
4743impl GlossaryEntry {
4744    pub fn new() -> Self {
4745        std::default::Default::default()
4746    }
4747
4748    /// Sets the value of [name][crate::model::GlossaryEntry::name].
4749    ///
4750    /// # Example
4751    /// ```ignore,no_run
4752    /// # use google_cloud_translation_v3::model::GlossaryEntry;
4753    /// let x = GlossaryEntry::new().set_name("example");
4754    /// ```
4755    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4756        self.name = v.into();
4757        self
4758    }
4759
4760    /// Sets the value of [description][crate::model::GlossaryEntry::description].
4761    ///
4762    /// # Example
4763    /// ```ignore,no_run
4764    /// # use google_cloud_translation_v3::model::GlossaryEntry;
4765    /// let x = GlossaryEntry::new().set_description("example");
4766    /// ```
4767    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4768        self.description = v.into();
4769        self
4770    }
4771
4772    /// Sets the value of [data][crate::model::GlossaryEntry::data].
4773    ///
4774    /// Note that all the setters affecting `data` are mutually
4775    /// exclusive.
4776    ///
4777    /// # Example
4778    /// ```ignore,no_run
4779    /// # use google_cloud_translation_v3::model::GlossaryEntry;
4780    /// use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4781    /// let x = GlossaryEntry::new().set_data(Some(
4782    ///     google_cloud_translation_v3::model::glossary_entry::Data::TermsPair(GlossaryTermsPair::default().into())));
4783    /// ```
4784    pub fn set_data<
4785        T: std::convert::Into<std::option::Option<crate::model::glossary_entry::Data>>,
4786    >(
4787        mut self,
4788        v: T,
4789    ) -> Self {
4790        self.data = v.into();
4791        self
4792    }
4793
4794    /// The value of [data][crate::model::GlossaryEntry::data]
4795    /// if it holds a `TermsPair`, `None` if the field is not set or
4796    /// holds a different branch.
4797    pub fn terms_pair(
4798        &self,
4799    ) -> std::option::Option<&std::boxed::Box<crate::model::glossary_entry::GlossaryTermsPair>>
4800    {
4801        #[allow(unreachable_patterns)]
4802        self.data.as_ref().and_then(|v| match v {
4803            crate::model::glossary_entry::Data::TermsPair(v) => std::option::Option::Some(v),
4804            _ => std::option::Option::None,
4805        })
4806    }
4807
4808    /// Sets the value of [data][crate::model::GlossaryEntry::data]
4809    /// to hold a `TermsPair`.
4810    ///
4811    /// Note that all the setters affecting `data` are
4812    /// mutually exclusive.
4813    ///
4814    /// # Example
4815    /// ```ignore,no_run
4816    /// # use google_cloud_translation_v3::model::GlossaryEntry;
4817    /// use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4818    /// let x = GlossaryEntry::new().set_terms_pair(GlossaryTermsPair::default()/* use setters */);
4819    /// assert!(x.terms_pair().is_some());
4820    /// assert!(x.terms_set().is_none());
4821    /// ```
4822    pub fn set_terms_pair<
4823        T: std::convert::Into<std::boxed::Box<crate::model::glossary_entry::GlossaryTermsPair>>,
4824    >(
4825        mut self,
4826        v: T,
4827    ) -> Self {
4828        self.data =
4829            std::option::Option::Some(crate::model::glossary_entry::Data::TermsPair(v.into()));
4830        self
4831    }
4832
4833    /// The value of [data][crate::model::GlossaryEntry::data]
4834    /// if it holds a `TermsSet`, `None` if the field is not set or
4835    /// holds a different branch.
4836    pub fn terms_set(
4837        &self,
4838    ) -> std::option::Option<&std::boxed::Box<crate::model::glossary_entry::GlossaryTermsSet>> {
4839        #[allow(unreachable_patterns)]
4840        self.data.as_ref().and_then(|v| match v {
4841            crate::model::glossary_entry::Data::TermsSet(v) => std::option::Option::Some(v),
4842            _ => std::option::Option::None,
4843        })
4844    }
4845
4846    /// Sets the value of [data][crate::model::GlossaryEntry::data]
4847    /// to hold a `TermsSet`.
4848    ///
4849    /// Note that all the setters affecting `data` are
4850    /// mutually exclusive.
4851    ///
4852    /// # Example
4853    /// ```ignore,no_run
4854    /// # use google_cloud_translation_v3::model::GlossaryEntry;
4855    /// use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsSet;
4856    /// let x = GlossaryEntry::new().set_terms_set(GlossaryTermsSet::default()/* use setters */);
4857    /// assert!(x.terms_set().is_some());
4858    /// assert!(x.terms_pair().is_none());
4859    /// ```
4860    pub fn set_terms_set<
4861        T: std::convert::Into<std::boxed::Box<crate::model::glossary_entry::GlossaryTermsSet>>,
4862    >(
4863        mut self,
4864        v: T,
4865    ) -> Self {
4866        self.data =
4867            std::option::Option::Some(crate::model::glossary_entry::Data::TermsSet(v.into()));
4868        self
4869    }
4870}
4871
4872impl wkt::message::Message for GlossaryEntry {
4873    fn typename() -> &'static str {
4874        "type.googleapis.com/google.cloud.translation.v3.GlossaryEntry"
4875    }
4876}
4877
4878/// Defines additional types related to [GlossaryEntry].
4879pub mod glossary_entry {
4880    #[allow(unused_imports)]
4881    use super::*;
4882
4883    /// Represents a single entry for an unidirectional glossary.
4884    #[derive(Clone, Default, PartialEq)]
4885    #[non_exhaustive]
4886    pub struct GlossaryTermsPair {
4887        /// The source term is the term that will get match in the text,
4888        pub source_term: std::option::Option<crate::model::GlossaryTerm>,
4889
4890        /// The term that will replace the match source term.
4891        pub target_term: std::option::Option<crate::model::GlossaryTerm>,
4892
4893        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4894    }
4895
4896    impl GlossaryTermsPair {
4897        pub fn new() -> Self {
4898            std::default::Default::default()
4899        }
4900
4901        /// Sets the value of [source_term][crate::model::glossary_entry::GlossaryTermsPair::source_term].
4902        ///
4903        /// # Example
4904        /// ```ignore,no_run
4905        /// # use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4906        /// use google_cloud_translation_v3::model::GlossaryTerm;
4907        /// let x = GlossaryTermsPair::new().set_source_term(GlossaryTerm::default()/* use setters */);
4908        /// ```
4909        pub fn set_source_term<T>(mut self, v: T) -> Self
4910        where
4911            T: std::convert::Into<crate::model::GlossaryTerm>,
4912        {
4913            self.source_term = std::option::Option::Some(v.into());
4914            self
4915        }
4916
4917        /// Sets or clears the value of [source_term][crate::model::glossary_entry::GlossaryTermsPair::source_term].
4918        ///
4919        /// # Example
4920        /// ```ignore,no_run
4921        /// # use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4922        /// use google_cloud_translation_v3::model::GlossaryTerm;
4923        /// let x = GlossaryTermsPair::new().set_or_clear_source_term(Some(GlossaryTerm::default()/* use setters */));
4924        /// let x = GlossaryTermsPair::new().set_or_clear_source_term(None::<GlossaryTerm>);
4925        /// ```
4926        pub fn set_or_clear_source_term<T>(mut self, v: std::option::Option<T>) -> Self
4927        where
4928            T: std::convert::Into<crate::model::GlossaryTerm>,
4929        {
4930            self.source_term = v.map(|x| x.into());
4931            self
4932        }
4933
4934        /// Sets the value of [target_term][crate::model::glossary_entry::GlossaryTermsPair::target_term].
4935        ///
4936        /// # Example
4937        /// ```ignore,no_run
4938        /// # use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4939        /// use google_cloud_translation_v3::model::GlossaryTerm;
4940        /// let x = GlossaryTermsPair::new().set_target_term(GlossaryTerm::default()/* use setters */);
4941        /// ```
4942        pub fn set_target_term<T>(mut self, v: T) -> Self
4943        where
4944            T: std::convert::Into<crate::model::GlossaryTerm>,
4945        {
4946            self.target_term = std::option::Option::Some(v.into());
4947            self
4948        }
4949
4950        /// Sets or clears the value of [target_term][crate::model::glossary_entry::GlossaryTermsPair::target_term].
4951        ///
4952        /// # Example
4953        /// ```ignore,no_run
4954        /// # use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsPair;
4955        /// use google_cloud_translation_v3::model::GlossaryTerm;
4956        /// let x = GlossaryTermsPair::new().set_or_clear_target_term(Some(GlossaryTerm::default()/* use setters */));
4957        /// let x = GlossaryTermsPair::new().set_or_clear_target_term(None::<GlossaryTerm>);
4958        /// ```
4959        pub fn set_or_clear_target_term<T>(mut self, v: std::option::Option<T>) -> Self
4960        where
4961            T: std::convert::Into<crate::model::GlossaryTerm>,
4962        {
4963            self.target_term = v.map(|x| x.into());
4964            self
4965        }
4966    }
4967
4968    impl wkt::message::Message for GlossaryTermsPair {
4969        fn typename() -> &'static str {
4970            "type.googleapis.com/google.cloud.translation.v3.GlossaryEntry.GlossaryTermsPair"
4971        }
4972    }
4973
4974    /// Represents a single entry for an equivalent term set glossary. This is used
4975    /// for equivalent term sets where each term can be replaced by the other terms
4976    /// in the set.
4977    #[derive(Clone, Default, PartialEq)]
4978    #[non_exhaustive]
4979    pub struct GlossaryTermsSet {
4980        /// Each term in the set represents a term that can be replaced by the other
4981        /// terms.
4982        pub terms: std::vec::Vec<crate::model::GlossaryTerm>,
4983
4984        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4985    }
4986
4987    impl GlossaryTermsSet {
4988        pub fn new() -> Self {
4989            std::default::Default::default()
4990        }
4991
4992        /// Sets the value of [terms][crate::model::glossary_entry::GlossaryTermsSet::terms].
4993        ///
4994        /// # Example
4995        /// ```ignore,no_run
4996        /// # use google_cloud_translation_v3::model::glossary_entry::GlossaryTermsSet;
4997        /// use google_cloud_translation_v3::model::GlossaryTerm;
4998        /// let x = GlossaryTermsSet::new()
4999        ///     .set_terms([
5000        ///         GlossaryTerm::default()/* use setters */,
5001        ///         GlossaryTerm::default()/* use (different) setters */,
5002        ///     ]);
5003        /// ```
5004        pub fn set_terms<T, V>(mut self, v: T) -> Self
5005        where
5006            T: std::iter::IntoIterator<Item = V>,
5007            V: std::convert::Into<crate::model::GlossaryTerm>,
5008        {
5009            use std::iter::Iterator;
5010            self.terms = v.into_iter().map(|i| i.into()).collect();
5011            self
5012        }
5013    }
5014
5015    impl wkt::message::Message for GlossaryTermsSet {
5016        fn typename() -> &'static str {
5017            "type.googleapis.com/google.cloud.translation.v3.GlossaryEntry.GlossaryTermsSet"
5018        }
5019    }
5020
5021    /// The different data for the glossary types (Unidirectional, Equivalent term
5022    /// sets).
5023    #[derive(Clone, Debug, PartialEq)]
5024    #[non_exhaustive]
5025    pub enum Data {
5026        /// Used for an unidirectional glossary.
5027        TermsPair(std::boxed::Box<crate::model::glossary_entry::GlossaryTermsPair>),
5028        /// Used for an equivalent term sets glossary.
5029        TermsSet(std::boxed::Box<crate::model::glossary_entry::GlossaryTermsSet>),
5030    }
5031}
5032
5033/// Represents a single glossary term
5034#[derive(Clone, Default, PartialEq)]
5035#[non_exhaustive]
5036pub struct GlossaryTerm {
5037    /// The language for this glossary term.
5038    pub language_code: std::string::String,
5039
5040    /// The text for the glossary term.
5041    pub text: std::string::String,
5042
5043    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5044}
5045
5046impl GlossaryTerm {
5047    pub fn new() -> Self {
5048        std::default::Default::default()
5049    }
5050
5051    /// Sets the value of [language_code][crate::model::GlossaryTerm::language_code].
5052    ///
5053    /// # Example
5054    /// ```ignore,no_run
5055    /// # use google_cloud_translation_v3::model::GlossaryTerm;
5056    /// let x = GlossaryTerm::new().set_language_code("example");
5057    /// ```
5058    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5059        self.language_code = v.into();
5060        self
5061    }
5062
5063    /// Sets the value of [text][crate::model::GlossaryTerm::text].
5064    ///
5065    /// # Example
5066    /// ```ignore,no_run
5067    /// # use google_cloud_translation_v3::model::GlossaryTerm;
5068    /// let x = GlossaryTerm::new().set_text("example");
5069    /// ```
5070    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5071        self.text = v.into();
5072        self
5073    }
5074}
5075
5076impl wkt::message::Message for GlossaryTerm {
5077    fn typename() -> &'static str {
5078        "type.googleapis.com/google.cloud.translation.v3.GlossaryTerm"
5079    }
5080}
5081
5082/// Configures transliteration feature on top of translation.
5083#[derive(Clone, Default, PartialEq)]
5084#[non_exhaustive]
5085pub struct TransliterationConfig {
5086    /// If true, source text in romanized form can be translated to the target
5087    /// language.
5088    pub enable_transliteration: bool,
5089
5090    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5091}
5092
5093impl TransliterationConfig {
5094    pub fn new() -> Self {
5095        std::default::Default::default()
5096    }
5097
5098    /// Sets the value of [enable_transliteration][crate::model::TransliterationConfig::enable_transliteration].
5099    ///
5100    /// # Example
5101    /// ```ignore,no_run
5102    /// # use google_cloud_translation_v3::model::TransliterationConfig;
5103    /// let x = TransliterationConfig::new().set_enable_transliteration(true);
5104    /// ```
5105    pub fn set_enable_transliteration<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5106        self.enable_transliteration = v.into();
5107        self
5108    }
5109}
5110
5111impl wkt::message::Message for TransliterationConfig {
5112    fn typename() -> &'static str {
5113        "type.googleapis.com/google.cloud.translation.v3.TransliterationConfig"
5114    }
5115}
5116
5117/// The request message for synchronous translation.
5118#[derive(Clone, Default, PartialEq)]
5119#[non_exhaustive]
5120pub struct TranslateTextRequest {
5121    /// Required. The content of the input in string format.
5122    /// We recommend the total content be less than 30,000 codepoints. The max
5123    /// length of this field is 1024. Use BatchTranslateText for larger text.
5124    pub contents: std::vec::Vec<std::string::String>,
5125
5126    /// Optional. The format of the source text, for example, "text/html",
5127    /// "text/plain". If left blank, the MIME type defaults to "text/html".
5128    pub mime_type: std::string::String,
5129
5130    /// Optional. The ISO-639 language code of the input text if
5131    /// known, for example, "en-US" or "sr-Latn". Supported language codes are
5132    /// listed in [Language
5133    /// Support](https://cloud.google.com/translate/docs/languages). If the source
5134    /// language isn't specified, the API attempts to identify the source language
5135    /// automatically and returns the source language within the response.
5136    pub source_language_code: std::string::String,
5137
5138    /// Required. The ISO-639 language code to use for translation of the input
5139    /// text, set to one of the language codes listed in [Language
5140    /// Support](https://cloud.google.com/translate/docs/languages).
5141    pub target_language_code: std::string::String,
5142
5143    /// Required. Project or location to make a call. Must refer to a caller's
5144    /// project.
5145    ///
5146    /// Format: `projects/{project-number-or-id}` or
5147    /// `projects/{project-number-or-id}/locations/{location-id}`.
5148    ///
5149    /// For global calls, use `projects/{project-number-or-id}/locations/global` or
5150    /// `projects/{project-number-or-id}`.
5151    ///
5152    /// Non-global location is required for requests using AutoML models or
5153    /// custom glossaries.
5154    ///
5155    /// Models and glossaries must be within the same region (have same
5156    /// location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
5157    pub parent: std::string::String,
5158
5159    /// Optional. The `model` type requested for this translation.
5160    ///
5161    /// The format depends on model type:
5162    ///
5163    /// - AutoML Translation models:
5164    ///   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
5165    ///
5166    /// - General (built-in) models:
5167    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
5168    ///
5169    /// - Translation LLM models:
5170    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
5171    ///
5172    ///
5173    /// For global (non-regionalized) requests, use `location-id` `global`.
5174    /// For example,
5175    /// `projects/{project-number-or-id}/locations/global/models/general/nmt`.
5176    ///
5177    /// If not provided, the default Google model (NMT) will be used
5178    pub model: std::string::String,
5179
5180    /// Optional. Glossary to be applied. The glossary must be
5181    /// within the same region (have the same location-id) as the model, otherwise
5182    /// an INVALID_ARGUMENT (400) error is returned.
5183    pub glossary_config: std::option::Option<crate::model::TranslateTextGlossaryConfig>,
5184
5185    /// Optional. Transliteration to be applied.
5186    pub transliteration_config: std::option::Option<crate::model::TransliterationConfig>,
5187
5188    /// Optional. The labels with user-defined metadata for the request.
5189    ///
5190    /// Label keys and values can be no longer than 63 characters
5191    /// (Unicode codepoints), can only contain lowercase letters, numeric
5192    /// characters, underscores and dashes. International characters are allowed.
5193    /// Label values are optional. Label keys must start with a letter.
5194    ///
5195    /// See <https://cloud.google.com/translate/docs/advanced/labels> for more
5196    /// information.
5197    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5198
5199    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5200}
5201
5202impl TranslateTextRequest {
5203    pub fn new() -> Self {
5204        std::default::Default::default()
5205    }
5206
5207    /// Sets the value of [contents][crate::model::TranslateTextRequest::contents].
5208    ///
5209    /// # Example
5210    /// ```ignore,no_run
5211    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5212    /// let x = TranslateTextRequest::new().set_contents(["a", "b", "c"]);
5213    /// ```
5214    pub fn set_contents<T, V>(mut self, v: T) -> Self
5215    where
5216        T: std::iter::IntoIterator<Item = V>,
5217        V: std::convert::Into<std::string::String>,
5218    {
5219        use std::iter::Iterator;
5220        self.contents = v.into_iter().map(|i| i.into()).collect();
5221        self
5222    }
5223
5224    /// Sets the value of [mime_type][crate::model::TranslateTextRequest::mime_type].
5225    ///
5226    /// # Example
5227    /// ```ignore,no_run
5228    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5229    /// let x = TranslateTextRequest::new().set_mime_type("example");
5230    /// ```
5231    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5232        self.mime_type = v.into();
5233        self
5234    }
5235
5236    /// Sets the value of [source_language_code][crate::model::TranslateTextRequest::source_language_code].
5237    ///
5238    /// # Example
5239    /// ```ignore,no_run
5240    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5241    /// let x = TranslateTextRequest::new().set_source_language_code("example");
5242    /// ```
5243    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
5244        mut self,
5245        v: T,
5246    ) -> Self {
5247        self.source_language_code = v.into();
5248        self
5249    }
5250
5251    /// Sets the value of [target_language_code][crate::model::TranslateTextRequest::target_language_code].
5252    ///
5253    /// # Example
5254    /// ```ignore,no_run
5255    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5256    /// let x = TranslateTextRequest::new().set_target_language_code("example");
5257    /// ```
5258    pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
5259        mut self,
5260        v: T,
5261    ) -> Self {
5262        self.target_language_code = v.into();
5263        self
5264    }
5265
5266    /// Sets the value of [parent][crate::model::TranslateTextRequest::parent].
5267    ///
5268    /// # Example
5269    /// ```ignore,no_run
5270    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5271    /// let x = TranslateTextRequest::new().set_parent("example");
5272    /// ```
5273    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5274        self.parent = v.into();
5275        self
5276    }
5277
5278    /// Sets the value of [model][crate::model::TranslateTextRequest::model].
5279    ///
5280    /// # Example
5281    /// ```ignore,no_run
5282    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5283    /// let x = TranslateTextRequest::new().set_model("example");
5284    /// ```
5285    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5286        self.model = v.into();
5287        self
5288    }
5289
5290    /// Sets the value of [glossary_config][crate::model::TranslateTextRequest::glossary_config].
5291    ///
5292    /// # Example
5293    /// ```ignore,no_run
5294    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5295    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
5296    /// let x = TranslateTextRequest::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);
5297    /// ```
5298    pub fn set_glossary_config<T>(mut self, v: T) -> Self
5299    where
5300        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
5301    {
5302        self.glossary_config = std::option::Option::Some(v.into());
5303        self
5304    }
5305
5306    /// Sets or clears the value of [glossary_config][crate::model::TranslateTextRequest::glossary_config].
5307    ///
5308    /// # Example
5309    /// ```ignore,no_run
5310    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5311    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
5312    /// let x = TranslateTextRequest::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
5313    /// let x = TranslateTextRequest::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);
5314    /// ```
5315    pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
5316    where
5317        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
5318    {
5319        self.glossary_config = v.map(|x| x.into());
5320        self
5321    }
5322
5323    /// Sets the value of [transliteration_config][crate::model::TranslateTextRequest::transliteration_config].
5324    ///
5325    /// # Example
5326    /// ```ignore,no_run
5327    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5328    /// use google_cloud_translation_v3::model::TransliterationConfig;
5329    /// let x = TranslateTextRequest::new().set_transliteration_config(TransliterationConfig::default()/* use setters */);
5330    /// ```
5331    pub fn set_transliteration_config<T>(mut self, v: T) -> Self
5332    where
5333        T: std::convert::Into<crate::model::TransliterationConfig>,
5334    {
5335        self.transliteration_config = std::option::Option::Some(v.into());
5336        self
5337    }
5338
5339    /// Sets or clears the value of [transliteration_config][crate::model::TranslateTextRequest::transliteration_config].
5340    ///
5341    /// # Example
5342    /// ```ignore,no_run
5343    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5344    /// use google_cloud_translation_v3::model::TransliterationConfig;
5345    /// let x = TranslateTextRequest::new().set_or_clear_transliteration_config(Some(TransliterationConfig::default()/* use setters */));
5346    /// let x = TranslateTextRequest::new().set_or_clear_transliteration_config(None::<TransliterationConfig>);
5347    /// ```
5348    pub fn set_or_clear_transliteration_config<T>(mut self, v: std::option::Option<T>) -> Self
5349    where
5350        T: std::convert::Into<crate::model::TransliterationConfig>,
5351    {
5352        self.transliteration_config = v.map(|x| x.into());
5353        self
5354    }
5355
5356    /// Sets the value of [labels][crate::model::TranslateTextRequest::labels].
5357    ///
5358    /// # Example
5359    /// ```ignore,no_run
5360    /// # use google_cloud_translation_v3::model::TranslateTextRequest;
5361    /// let x = TranslateTextRequest::new().set_labels([
5362    ///     ("key0", "abc"),
5363    ///     ("key1", "xyz"),
5364    /// ]);
5365    /// ```
5366    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5367    where
5368        T: std::iter::IntoIterator<Item = (K, V)>,
5369        K: std::convert::Into<std::string::String>,
5370        V: std::convert::Into<std::string::String>,
5371    {
5372        use std::iter::Iterator;
5373        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5374        self
5375    }
5376}
5377
5378impl wkt::message::Message for TranslateTextRequest {
5379    fn typename() -> &'static str {
5380        "type.googleapis.com/google.cloud.translation.v3.TranslateTextRequest"
5381    }
5382}
5383
5384#[derive(Clone, Default, PartialEq)]
5385#[non_exhaustive]
5386pub struct TranslateTextResponse {
5387    /// Text translation responses with no glossary applied.
5388    /// This field has the same length as
5389    /// [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
5390    ///
5391    /// [google.cloud.translation.v3.TranslateTextRequest.contents]: crate::model::TranslateTextRequest::contents
5392    pub translations: std::vec::Vec<crate::model::Translation>,
5393
5394    /// Text translation responses if a glossary is provided in the request.
5395    /// This can be the same as
5396    /// [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
5397    /// if no terms apply. This field has the same length as
5398    /// [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
5399    ///
5400    /// [google.cloud.translation.v3.TranslateTextRequest.contents]: crate::model::TranslateTextRequest::contents
5401    /// [google.cloud.translation.v3.TranslateTextResponse.translations]: crate::model::TranslateTextResponse::translations
5402    pub glossary_translations: std::vec::Vec<crate::model::Translation>,
5403
5404    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5405}
5406
5407impl TranslateTextResponse {
5408    pub fn new() -> Self {
5409        std::default::Default::default()
5410    }
5411
5412    /// Sets the value of [translations][crate::model::TranslateTextResponse::translations].
5413    ///
5414    /// # Example
5415    /// ```ignore,no_run
5416    /// # use google_cloud_translation_v3::model::TranslateTextResponse;
5417    /// use google_cloud_translation_v3::model::Translation;
5418    /// let x = TranslateTextResponse::new()
5419    ///     .set_translations([
5420    ///         Translation::default()/* use setters */,
5421    ///         Translation::default()/* use (different) setters */,
5422    ///     ]);
5423    /// ```
5424    pub fn set_translations<T, V>(mut self, v: T) -> Self
5425    where
5426        T: std::iter::IntoIterator<Item = V>,
5427        V: std::convert::Into<crate::model::Translation>,
5428    {
5429        use std::iter::Iterator;
5430        self.translations = v.into_iter().map(|i| i.into()).collect();
5431        self
5432    }
5433
5434    /// Sets the value of [glossary_translations][crate::model::TranslateTextResponse::glossary_translations].
5435    ///
5436    /// # Example
5437    /// ```ignore,no_run
5438    /// # use google_cloud_translation_v3::model::TranslateTextResponse;
5439    /// use google_cloud_translation_v3::model::Translation;
5440    /// let x = TranslateTextResponse::new()
5441    ///     .set_glossary_translations([
5442    ///         Translation::default()/* use setters */,
5443    ///         Translation::default()/* use (different) setters */,
5444    ///     ]);
5445    /// ```
5446    pub fn set_glossary_translations<T, V>(mut self, v: T) -> Self
5447    where
5448        T: std::iter::IntoIterator<Item = V>,
5449        V: std::convert::Into<crate::model::Translation>,
5450    {
5451        use std::iter::Iterator;
5452        self.glossary_translations = v.into_iter().map(|i| i.into()).collect();
5453        self
5454    }
5455}
5456
5457impl wkt::message::Message for TranslateTextResponse {
5458    fn typename() -> &'static str {
5459        "type.googleapis.com/google.cloud.translation.v3.TranslateTextResponse"
5460    }
5461}
5462
5463/// A single translation response.
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct Translation {
5467    /// Text translated into the target language.
5468    /// If an error occurs during translation, this field might be excluded from
5469    /// the response.
5470    pub translated_text: std::string::String,
5471
5472    /// Only present when `model` is present in the request.
5473    /// `model` here is normalized to have project number.
5474    ///
5475    /// For example:
5476    /// If the `model` requested in TranslationTextRequest is
5477    /// `projects/{project-id}/locations/{location-id}/models/general/nmt` then
5478    /// `model` here would be normalized to
5479    /// `projects/{project-number}/locations/{location-id}/models/general/nmt`.
5480    pub model: std::string::String,
5481
5482    /// The ISO-639 language code of source text in the initial request, detected
5483    /// automatically, if no source language was passed within the initial
5484    /// request. If the source language was passed, auto-detection of the language
5485    /// does not occur and this field is empty.
5486    pub detected_language_code: std::string::String,
5487
5488    /// The `glossary_config` used for this translation.
5489    pub glossary_config: std::option::Option<crate::model::TranslateTextGlossaryConfig>,
5490
5491    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5492}
5493
5494impl Translation {
5495    pub fn new() -> Self {
5496        std::default::Default::default()
5497    }
5498
5499    /// Sets the value of [translated_text][crate::model::Translation::translated_text].
5500    ///
5501    /// # Example
5502    /// ```ignore,no_run
5503    /// # use google_cloud_translation_v3::model::Translation;
5504    /// let x = Translation::new().set_translated_text("example");
5505    /// ```
5506    pub fn set_translated_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5507        self.translated_text = v.into();
5508        self
5509    }
5510
5511    /// Sets the value of [model][crate::model::Translation::model].
5512    ///
5513    /// # Example
5514    /// ```ignore,no_run
5515    /// # use google_cloud_translation_v3::model::Translation;
5516    /// let x = Translation::new().set_model("example");
5517    /// ```
5518    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5519        self.model = v.into();
5520        self
5521    }
5522
5523    /// Sets the value of [detected_language_code][crate::model::Translation::detected_language_code].
5524    ///
5525    /// # Example
5526    /// ```ignore,no_run
5527    /// # use google_cloud_translation_v3::model::Translation;
5528    /// let x = Translation::new().set_detected_language_code("example");
5529    /// ```
5530    pub fn set_detected_language_code<T: std::convert::Into<std::string::String>>(
5531        mut self,
5532        v: T,
5533    ) -> Self {
5534        self.detected_language_code = v.into();
5535        self
5536    }
5537
5538    /// Sets the value of [glossary_config][crate::model::Translation::glossary_config].
5539    ///
5540    /// # Example
5541    /// ```ignore,no_run
5542    /// # use google_cloud_translation_v3::model::Translation;
5543    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
5544    /// let x = Translation::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);
5545    /// ```
5546    pub fn set_glossary_config<T>(mut self, v: T) -> Self
5547    where
5548        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
5549    {
5550        self.glossary_config = std::option::Option::Some(v.into());
5551        self
5552    }
5553
5554    /// Sets or clears the value of [glossary_config][crate::model::Translation::glossary_config].
5555    ///
5556    /// # Example
5557    /// ```ignore,no_run
5558    /// # use google_cloud_translation_v3::model::Translation;
5559    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
5560    /// let x = Translation::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
5561    /// let x = Translation::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);
5562    /// ```
5563    pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
5564    where
5565        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
5566    {
5567        self.glossary_config = v.map(|x| x.into());
5568        self
5569    }
5570}
5571
5572impl wkt::message::Message for Translation {
5573    fn typename() -> &'static str {
5574        "type.googleapis.com/google.cloud.translation.v3.Translation"
5575    }
5576}
5577
5578/// The request message for synchronous romanization.
5579#[derive(Clone, Default, PartialEq)]
5580#[non_exhaustive]
5581pub struct RomanizeTextRequest {
5582    /// Required. Project or location to make a call. Must refer to a caller's
5583    /// project.
5584    ///
5585    /// Format: `projects/{project-number-or-id}/locations/{location-id}` or
5586    /// `projects/{project-number-or-id}`.
5587    ///
5588    /// For global calls, use `projects/{project-number-or-id}/locations/global` or
5589    /// `projects/{project-number-or-id}`.
5590    pub parent: std::string::String,
5591
5592    /// Required. The content of the input in string format.
5593    pub contents: std::vec::Vec<std::string::String>,
5594
5595    /// Optional. The ISO-639 language code of the input text if
5596    /// known, for example, "hi" or "zh". Supported language codes are
5597    /// listed in [Language
5598    /// Support](https://cloud.google.com/translate/docs/languages#roman). If the
5599    /// source language isn't specified, the API attempts to identify the source
5600    /// language automatically and returns the source language for each content in
5601    /// the response.
5602    pub source_language_code: std::string::String,
5603
5604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5605}
5606
5607impl RomanizeTextRequest {
5608    pub fn new() -> Self {
5609        std::default::Default::default()
5610    }
5611
5612    /// Sets the value of [parent][crate::model::RomanizeTextRequest::parent].
5613    ///
5614    /// # Example
5615    /// ```ignore,no_run
5616    /// # use google_cloud_translation_v3::model::RomanizeTextRequest;
5617    /// let x = RomanizeTextRequest::new().set_parent("example");
5618    /// ```
5619    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5620        self.parent = v.into();
5621        self
5622    }
5623
5624    /// Sets the value of [contents][crate::model::RomanizeTextRequest::contents].
5625    ///
5626    /// # Example
5627    /// ```ignore,no_run
5628    /// # use google_cloud_translation_v3::model::RomanizeTextRequest;
5629    /// let x = RomanizeTextRequest::new().set_contents(["a", "b", "c"]);
5630    /// ```
5631    pub fn set_contents<T, V>(mut self, v: T) -> Self
5632    where
5633        T: std::iter::IntoIterator<Item = V>,
5634        V: std::convert::Into<std::string::String>,
5635    {
5636        use std::iter::Iterator;
5637        self.contents = v.into_iter().map(|i| i.into()).collect();
5638        self
5639    }
5640
5641    /// Sets the value of [source_language_code][crate::model::RomanizeTextRequest::source_language_code].
5642    ///
5643    /// # Example
5644    /// ```ignore,no_run
5645    /// # use google_cloud_translation_v3::model::RomanizeTextRequest;
5646    /// let x = RomanizeTextRequest::new().set_source_language_code("example");
5647    /// ```
5648    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
5649        mut self,
5650        v: T,
5651    ) -> Self {
5652        self.source_language_code = v.into();
5653        self
5654    }
5655}
5656
5657impl wkt::message::Message for RomanizeTextRequest {
5658    fn typename() -> &'static str {
5659        "type.googleapis.com/google.cloud.translation.v3.RomanizeTextRequest"
5660    }
5661}
5662
5663/// A single romanization response.
5664#[derive(Clone, Default, PartialEq)]
5665#[non_exhaustive]
5666pub struct Romanization {
5667    /// Romanized text.
5668    /// If an error occurs during romanization, this field might be excluded from
5669    /// the response.
5670    pub romanized_text: std::string::String,
5671
5672    /// The ISO-639 language code of source text in the initial request, detected
5673    /// automatically, if no source language was passed within the initial
5674    /// request. If the source language was passed, auto-detection of the language
5675    /// does not occur and this field is empty.
5676    pub detected_language_code: std::string::String,
5677
5678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5679}
5680
5681impl Romanization {
5682    pub fn new() -> Self {
5683        std::default::Default::default()
5684    }
5685
5686    /// Sets the value of [romanized_text][crate::model::Romanization::romanized_text].
5687    ///
5688    /// # Example
5689    /// ```ignore,no_run
5690    /// # use google_cloud_translation_v3::model::Romanization;
5691    /// let x = Romanization::new().set_romanized_text("example");
5692    /// ```
5693    pub fn set_romanized_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5694        self.romanized_text = v.into();
5695        self
5696    }
5697
5698    /// Sets the value of [detected_language_code][crate::model::Romanization::detected_language_code].
5699    ///
5700    /// # Example
5701    /// ```ignore,no_run
5702    /// # use google_cloud_translation_v3::model::Romanization;
5703    /// let x = Romanization::new().set_detected_language_code("example");
5704    /// ```
5705    pub fn set_detected_language_code<T: std::convert::Into<std::string::String>>(
5706        mut self,
5707        v: T,
5708    ) -> Self {
5709        self.detected_language_code = v.into();
5710        self
5711    }
5712}
5713
5714impl wkt::message::Message for Romanization {
5715    fn typename() -> &'static str {
5716        "type.googleapis.com/google.cloud.translation.v3.Romanization"
5717    }
5718}
5719
5720/// The response message for synchronous romanization.
5721#[derive(Clone, Default, PartialEq)]
5722#[non_exhaustive]
5723pub struct RomanizeTextResponse {
5724    /// Text romanization responses.
5725    /// This field has the same length as
5726    /// [`contents`][google.cloud.translation.v3.RomanizeTextRequest.contents].
5727    ///
5728    /// [google.cloud.translation.v3.RomanizeTextRequest.contents]: crate::model::RomanizeTextRequest::contents
5729    pub romanizations: std::vec::Vec<crate::model::Romanization>,
5730
5731    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5732}
5733
5734impl RomanizeTextResponse {
5735    pub fn new() -> Self {
5736        std::default::Default::default()
5737    }
5738
5739    /// Sets the value of [romanizations][crate::model::RomanizeTextResponse::romanizations].
5740    ///
5741    /// # Example
5742    /// ```ignore,no_run
5743    /// # use google_cloud_translation_v3::model::RomanizeTextResponse;
5744    /// use google_cloud_translation_v3::model::Romanization;
5745    /// let x = RomanizeTextResponse::new()
5746    ///     .set_romanizations([
5747    ///         Romanization::default()/* use setters */,
5748    ///         Romanization::default()/* use (different) setters */,
5749    ///     ]);
5750    /// ```
5751    pub fn set_romanizations<T, V>(mut self, v: T) -> Self
5752    where
5753        T: std::iter::IntoIterator<Item = V>,
5754        V: std::convert::Into<crate::model::Romanization>,
5755    {
5756        use std::iter::Iterator;
5757        self.romanizations = v.into_iter().map(|i| i.into()).collect();
5758        self
5759    }
5760}
5761
5762impl wkt::message::Message for RomanizeTextResponse {
5763    fn typename() -> &'static str {
5764        "type.googleapis.com/google.cloud.translation.v3.RomanizeTextResponse"
5765    }
5766}
5767
5768/// The request message for language detection.
5769#[derive(Clone, Default, PartialEq)]
5770#[non_exhaustive]
5771pub struct DetectLanguageRequest {
5772    /// Required. Project or location to make a call. Must refer to a caller's
5773    /// project.
5774    ///
5775    /// Format: `projects/{project-number-or-id}/locations/{location-id}` or
5776    /// `projects/{project-number-or-id}`.
5777    ///
5778    /// For global calls, use `projects/{project-number-or-id}/locations/global` or
5779    /// `projects/{project-number-or-id}`.
5780    ///
5781    /// Only models within the same region (has same location-id) can be used.
5782    /// Otherwise an INVALID_ARGUMENT (400) error is returned.
5783    pub parent: std::string::String,
5784
5785    /// Optional. The language detection model to be used.
5786    ///
5787    /// Format:
5788    /// `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
5789    ///
5790    /// Only one language detection model is currently supported:
5791    /// `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
5792    ///
5793    /// If not specified, the default model is used.
5794    pub model: std::string::String,
5795
5796    /// Optional. The format of the source text, for example, "text/html",
5797    /// "text/plain". If left blank, the MIME type defaults to "text/html".
5798    pub mime_type: std::string::String,
5799
5800    /// Optional. The labels with user-defined metadata for the request.
5801    ///
5802    /// Label keys and values can be no longer than 63 characters
5803    /// (Unicode codepoints), can only contain lowercase letters, numeric
5804    /// characters, underscores and dashes. International characters are allowed.
5805    /// Label values are optional. Label keys must start with a letter.
5806    ///
5807    /// See <https://cloud.google.com/translate/docs/advanced/labels> for more
5808    /// information.
5809    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5810
5811    /// Required. The source of the document from which to detect the language.
5812    pub source: std::option::Option<crate::model::detect_language_request::Source>,
5813
5814    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5815}
5816
5817impl DetectLanguageRequest {
5818    pub fn new() -> Self {
5819        std::default::Default::default()
5820    }
5821
5822    /// Sets the value of [parent][crate::model::DetectLanguageRequest::parent].
5823    ///
5824    /// # Example
5825    /// ```ignore,no_run
5826    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5827    /// let x = DetectLanguageRequest::new().set_parent("example");
5828    /// ```
5829    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5830        self.parent = v.into();
5831        self
5832    }
5833
5834    /// Sets the value of [model][crate::model::DetectLanguageRequest::model].
5835    ///
5836    /// # Example
5837    /// ```ignore,no_run
5838    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5839    /// let x = DetectLanguageRequest::new().set_model("example");
5840    /// ```
5841    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5842        self.model = v.into();
5843        self
5844    }
5845
5846    /// Sets the value of [mime_type][crate::model::DetectLanguageRequest::mime_type].
5847    ///
5848    /// # Example
5849    /// ```ignore,no_run
5850    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5851    /// let x = DetectLanguageRequest::new().set_mime_type("example");
5852    /// ```
5853    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5854        self.mime_type = v.into();
5855        self
5856    }
5857
5858    /// Sets the value of [labels][crate::model::DetectLanguageRequest::labels].
5859    ///
5860    /// # Example
5861    /// ```ignore,no_run
5862    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5863    /// let x = DetectLanguageRequest::new().set_labels([
5864    ///     ("key0", "abc"),
5865    ///     ("key1", "xyz"),
5866    /// ]);
5867    /// ```
5868    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5869    where
5870        T: std::iter::IntoIterator<Item = (K, V)>,
5871        K: std::convert::Into<std::string::String>,
5872        V: std::convert::Into<std::string::String>,
5873    {
5874        use std::iter::Iterator;
5875        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5876        self
5877    }
5878
5879    /// Sets the value of [source][crate::model::DetectLanguageRequest::source].
5880    ///
5881    /// Note that all the setters affecting `source` are mutually
5882    /// exclusive.
5883    ///
5884    /// # Example
5885    /// ```ignore,no_run
5886    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5887    /// use google_cloud_translation_v3::model::detect_language_request::Source;
5888    /// let x = DetectLanguageRequest::new().set_source(Some(Source::Content("example".to_string())));
5889    /// ```
5890    pub fn set_source<
5891        T: std::convert::Into<std::option::Option<crate::model::detect_language_request::Source>>,
5892    >(
5893        mut self,
5894        v: T,
5895    ) -> Self {
5896        self.source = v.into();
5897        self
5898    }
5899
5900    /// The value of [source][crate::model::DetectLanguageRequest::source]
5901    /// if it holds a `Content`, `None` if the field is not set or
5902    /// holds a different branch.
5903    pub fn content(&self) -> std::option::Option<&std::string::String> {
5904        #[allow(unreachable_patterns)]
5905        self.source.as_ref().and_then(|v| match v {
5906            crate::model::detect_language_request::Source::Content(v) => {
5907                std::option::Option::Some(v)
5908            }
5909            _ => std::option::Option::None,
5910        })
5911    }
5912
5913    /// Sets the value of [source][crate::model::DetectLanguageRequest::source]
5914    /// to hold a `Content`.
5915    ///
5916    /// Note that all the setters affecting `source` are
5917    /// mutually exclusive.
5918    ///
5919    /// # Example
5920    /// ```ignore,no_run
5921    /// # use google_cloud_translation_v3::model::DetectLanguageRequest;
5922    /// let x = DetectLanguageRequest::new().set_content("example");
5923    /// assert!(x.content().is_some());
5924    /// ```
5925    pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5926        self.source = std::option::Option::Some(
5927            crate::model::detect_language_request::Source::Content(v.into()),
5928        );
5929        self
5930    }
5931}
5932
5933impl wkt::message::Message for DetectLanguageRequest {
5934    fn typename() -> &'static str {
5935        "type.googleapis.com/google.cloud.translation.v3.DetectLanguageRequest"
5936    }
5937}
5938
5939/// Defines additional types related to [DetectLanguageRequest].
5940pub mod detect_language_request {
5941    #[allow(unused_imports)]
5942    use super::*;
5943
5944    /// Required. The source of the document from which to detect the language.
5945    #[derive(Clone, Debug, PartialEq)]
5946    #[non_exhaustive]
5947    pub enum Source {
5948        /// The content of the input stored as a string.
5949        Content(std::string::String),
5950    }
5951}
5952
5953/// The response message for language detection.
5954#[derive(Clone, Default, PartialEq)]
5955#[non_exhaustive]
5956pub struct DetectedLanguage {
5957    /// The ISO-639 language code of the source content in the request, detected
5958    /// automatically.
5959    pub language_code: std::string::String,
5960
5961    /// The confidence of the detection result for this language.
5962    pub confidence: f32,
5963
5964    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5965}
5966
5967impl DetectedLanguage {
5968    pub fn new() -> Self {
5969        std::default::Default::default()
5970    }
5971
5972    /// Sets the value of [language_code][crate::model::DetectedLanguage::language_code].
5973    ///
5974    /// # Example
5975    /// ```ignore,no_run
5976    /// # use google_cloud_translation_v3::model::DetectedLanguage;
5977    /// let x = DetectedLanguage::new().set_language_code("example");
5978    /// ```
5979    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5980        self.language_code = v.into();
5981        self
5982    }
5983
5984    /// Sets the value of [confidence][crate::model::DetectedLanguage::confidence].
5985    ///
5986    /// # Example
5987    /// ```ignore,no_run
5988    /// # use google_cloud_translation_v3::model::DetectedLanguage;
5989    /// let x = DetectedLanguage::new().set_confidence(42.0);
5990    /// ```
5991    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5992        self.confidence = v.into();
5993        self
5994    }
5995}
5996
5997impl wkt::message::Message for DetectedLanguage {
5998    fn typename() -> &'static str {
5999        "type.googleapis.com/google.cloud.translation.v3.DetectedLanguage"
6000    }
6001}
6002
6003/// The response message for language detection.
6004#[derive(Clone, Default, PartialEq)]
6005#[non_exhaustive]
6006pub struct DetectLanguageResponse {
6007    /// The most probable language detected by the Translation API. For each
6008    /// request, the Translation API will always return only one result.
6009    pub languages: std::vec::Vec<crate::model::DetectedLanguage>,
6010
6011    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6012}
6013
6014impl DetectLanguageResponse {
6015    pub fn new() -> Self {
6016        std::default::Default::default()
6017    }
6018
6019    /// Sets the value of [languages][crate::model::DetectLanguageResponse::languages].
6020    ///
6021    /// # Example
6022    /// ```ignore,no_run
6023    /// # use google_cloud_translation_v3::model::DetectLanguageResponse;
6024    /// use google_cloud_translation_v3::model::DetectedLanguage;
6025    /// let x = DetectLanguageResponse::new()
6026    ///     .set_languages([
6027    ///         DetectedLanguage::default()/* use setters */,
6028    ///         DetectedLanguage::default()/* use (different) setters */,
6029    ///     ]);
6030    /// ```
6031    pub fn set_languages<T, V>(mut self, v: T) -> Self
6032    where
6033        T: std::iter::IntoIterator<Item = V>,
6034        V: std::convert::Into<crate::model::DetectedLanguage>,
6035    {
6036        use std::iter::Iterator;
6037        self.languages = v.into_iter().map(|i| i.into()).collect();
6038        self
6039    }
6040}
6041
6042impl wkt::message::Message for DetectLanguageResponse {
6043    fn typename() -> &'static str {
6044        "type.googleapis.com/google.cloud.translation.v3.DetectLanguageResponse"
6045    }
6046}
6047
6048/// The request message for discovering supported languages.
6049#[derive(Clone, Default, PartialEq)]
6050#[non_exhaustive]
6051pub struct GetSupportedLanguagesRequest {
6052    /// Required. Project or location to make a call. Must refer to a caller's
6053    /// project.
6054    ///
6055    /// Format: `projects/{project-number-or-id}` or
6056    /// `projects/{project-number-or-id}/locations/{location-id}`.
6057    ///
6058    /// For global calls, use `projects/{project-number-or-id}/locations/global` or
6059    /// `projects/{project-number-or-id}`.
6060    ///
6061    /// Non-global location is required for AutoML models.
6062    ///
6063    /// Only models within the same region (have same location-id) can be used,
6064    /// otherwise an INVALID_ARGUMENT (400) error is returned.
6065    pub parent: std::string::String,
6066
6067    /// Optional. The language to use to return localized, human readable names
6068    /// of supported languages. If missing, then display names are not returned
6069    /// in a response.
6070    pub display_language_code: std::string::String,
6071
6072    /// Optional. Get supported languages of this model.
6073    ///
6074    /// The format depends on model type:
6075    ///
6076    /// - AutoML Translation models:
6077    ///   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
6078    ///
6079    /// - General (built-in) models:
6080    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
6081    ///
6082    ///
6083    /// Returns languages supported by the specified model.
6084    /// If missing, we get supported languages of Google general NMT model.
6085    pub model: std::string::String,
6086
6087    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6088}
6089
6090impl GetSupportedLanguagesRequest {
6091    pub fn new() -> Self {
6092        std::default::Default::default()
6093    }
6094
6095    /// Sets the value of [parent][crate::model::GetSupportedLanguagesRequest::parent].
6096    ///
6097    /// # Example
6098    /// ```ignore,no_run
6099    /// # use google_cloud_translation_v3::model::GetSupportedLanguagesRequest;
6100    /// let x = GetSupportedLanguagesRequest::new().set_parent("example");
6101    /// ```
6102    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6103        self.parent = v.into();
6104        self
6105    }
6106
6107    /// Sets the value of [display_language_code][crate::model::GetSupportedLanguagesRequest::display_language_code].
6108    ///
6109    /// # Example
6110    /// ```ignore,no_run
6111    /// # use google_cloud_translation_v3::model::GetSupportedLanguagesRequest;
6112    /// let x = GetSupportedLanguagesRequest::new().set_display_language_code("example");
6113    /// ```
6114    pub fn set_display_language_code<T: std::convert::Into<std::string::String>>(
6115        mut self,
6116        v: T,
6117    ) -> Self {
6118        self.display_language_code = v.into();
6119        self
6120    }
6121
6122    /// Sets the value of [model][crate::model::GetSupportedLanguagesRequest::model].
6123    ///
6124    /// # Example
6125    /// ```ignore,no_run
6126    /// # use google_cloud_translation_v3::model::GetSupportedLanguagesRequest;
6127    /// let x = GetSupportedLanguagesRequest::new().set_model("example");
6128    /// ```
6129    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6130        self.model = v.into();
6131        self
6132    }
6133}
6134
6135impl wkt::message::Message for GetSupportedLanguagesRequest {
6136    fn typename() -> &'static str {
6137        "type.googleapis.com/google.cloud.translation.v3.GetSupportedLanguagesRequest"
6138    }
6139}
6140
6141/// The response message for discovering supported languages.
6142#[derive(Clone, Default, PartialEq)]
6143#[non_exhaustive]
6144pub struct SupportedLanguages {
6145    /// A list of supported language responses. This list contains an entry
6146    /// for each language the Translation API supports.
6147    pub languages: std::vec::Vec<crate::model::SupportedLanguage>,
6148
6149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6150}
6151
6152impl SupportedLanguages {
6153    pub fn new() -> Self {
6154        std::default::Default::default()
6155    }
6156
6157    /// Sets the value of [languages][crate::model::SupportedLanguages::languages].
6158    ///
6159    /// # Example
6160    /// ```ignore,no_run
6161    /// # use google_cloud_translation_v3::model::SupportedLanguages;
6162    /// use google_cloud_translation_v3::model::SupportedLanguage;
6163    /// let x = SupportedLanguages::new()
6164    ///     .set_languages([
6165    ///         SupportedLanguage::default()/* use setters */,
6166    ///         SupportedLanguage::default()/* use (different) setters */,
6167    ///     ]);
6168    /// ```
6169    pub fn set_languages<T, V>(mut self, v: T) -> Self
6170    where
6171        T: std::iter::IntoIterator<Item = V>,
6172        V: std::convert::Into<crate::model::SupportedLanguage>,
6173    {
6174        use std::iter::Iterator;
6175        self.languages = v.into_iter().map(|i| i.into()).collect();
6176        self
6177    }
6178}
6179
6180impl wkt::message::Message for SupportedLanguages {
6181    fn typename() -> &'static str {
6182        "type.googleapis.com/google.cloud.translation.v3.SupportedLanguages"
6183    }
6184}
6185
6186/// A single supported language response corresponds to information related
6187/// to one supported language.
6188#[derive(Clone, Default, PartialEq)]
6189#[non_exhaustive]
6190pub struct SupportedLanguage {
6191    /// Supported language code, generally consisting of its ISO 639-1
6192    /// identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes
6193    /// including language and region identifiers are returned (for example,
6194    /// 'zh-TW' and 'zh-CN').
6195    pub language_code: std::string::String,
6196
6197    /// Human-readable name of the language localized in the display language
6198    /// specified in the request.
6199    pub display_name: std::string::String,
6200
6201    /// Can be used as a source language.
6202    pub support_source: bool,
6203
6204    /// Can be used as a target language.
6205    pub support_target: bool,
6206
6207    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6208}
6209
6210impl SupportedLanguage {
6211    pub fn new() -> Self {
6212        std::default::Default::default()
6213    }
6214
6215    /// Sets the value of [language_code][crate::model::SupportedLanguage::language_code].
6216    ///
6217    /// # Example
6218    /// ```ignore,no_run
6219    /// # use google_cloud_translation_v3::model::SupportedLanguage;
6220    /// let x = SupportedLanguage::new().set_language_code("example");
6221    /// ```
6222    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6223        self.language_code = v.into();
6224        self
6225    }
6226
6227    /// Sets the value of [display_name][crate::model::SupportedLanguage::display_name].
6228    ///
6229    /// # Example
6230    /// ```ignore,no_run
6231    /// # use google_cloud_translation_v3::model::SupportedLanguage;
6232    /// let x = SupportedLanguage::new().set_display_name("example");
6233    /// ```
6234    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6235        self.display_name = v.into();
6236        self
6237    }
6238
6239    /// Sets the value of [support_source][crate::model::SupportedLanguage::support_source].
6240    ///
6241    /// # Example
6242    /// ```ignore,no_run
6243    /// # use google_cloud_translation_v3::model::SupportedLanguage;
6244    /// let x = SupportedLanguage::new().set_support_source(true);
6245    /// ```
6246    pub fn set_support_source<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6247        self.support_source = v.into();
6248        self
6249    }
6250
6251    /// Sets the value of [support_target][crate::model::SupportedLanguage::support_target].
6252    ///
6253    /// # Example
6254    /// ```ignore,no_run
6255    /// # use google_cloud_translation_v3::model::SupportedLanguage;
6256    /// let x = SupportedLanguage::new().set_support_target(true);
6257    /// ```
6258    pub fn set_support_target<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6259        self.support_target = v.into();
6260        self
6261    }
6262}
6263
6264impl wkt::message::Message for SupportedLanguage {
6265    fn typename() -> &'static str {
6266        "type.googleapis.com/google.cloud.translation.v3.SupportedLanguage"
6267    }
6268}
6269
6270/// The Google Cloud Storage location for the input content.
6271#[derive(Clone, Default, PartialEq)]
6272#[non_exhaustive]
6273pub struct GcsSource {
6274    /// Required. Source data URI. For example, `gs://my_bucket/my_object`.
6275    pub input_uri: std::string::String,
6276
6277    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6278}
6279
6280impl GcsSource {
6281    pub fn new() -> Self {
6282        std::default::Default::default()
6283    }
6284
6285    /// Sets the value of [input_uri][crate::model::GcsSource::input_uri].
6286    ///
6287    /// # Example
6288    /// ```ignore,no_run
6289    /// # use google_cloud_translation_v3::model::GcsSource;
6290    /// let x = GcsSource::new().set_input_uri("example");
6291    /// ```
6292    pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6293        self.input_uri = v.into();
6294        self
6295    }
6296}
6297
6298impl wkt::message::Message for GcsSource {
6299    fn typename() -> &'static str {
6300        "type.googleapis.com/google.cloud.translation.v3.GcsSource"
6301    }
6302}
6303
6304/// Input configuration for BatchTranslateText request.
6305#[derive(Clone, Default, PartialEq)]
6306#[non_exhaustive]
6307pub struct InputConfig {
6308    /// Optional. Can be "text/plain" or "text/html".
6309    /// For `.tsv`, "text/html" is used if mime_type is missing.
6310    /// For `.html`, this field must be "text/html" or empty.
6311    /// For `.txt`, this field must be "text/plain" or empty.
6312    pub mime_type: std::string::String,
6313
6314    /// Required. Specify the input.
6315    pub source: std::option::Option<crate::model::input_config::Source>,
6316
6317    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6318}
6319
6320impl InputConfig {
6321    pub fn new() -> Self {
6322        std::default::Default::default()
6323    }
6324
6325    /// Sets the value of [mime_type][crate::model::InputConfig::mime_type].
6326    ///
6327    /// # Example
6328    /// ```ignore,no_run
6329    /// # use google_cloud_translation_v3::model::InputConfig;
6330    /// let x = InputConfig::new().set_mime_type("example");
6331    /// ```
6332    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6333        self.mime_type = v.into();
6334        self
6335    }
6336
6337    /// Sets the value of [source][crate::model::InputConfig::source].
6338    ///
6339    /// Note that all the setters affecting `source` are mutually
6340    /// exclusive.
6341    ///
6342    /// # Example
6343    /// ```ignore,no_run
6344    /// # use google_cloud_translation_v3::model::InputConfig;
6345    /// use google_cloud_translation_v3::model::GcsSource;
6346    /// let x = InputConfig::new().set_source(Some(
6347    ///     google_cloud_translation_v3::model::input_config::Source::GcsSource(GcsSource::default().into())));
6348    /// ```
6349    pub fn set_source<
6350        T: std::convert::Into<std::option::Option<crate::model::input_config::Source>>,
6351    >(
6352        mut self,
6353        v: T,
6354    ) -> Self {
6355        self.source = v.into();
6356        self
6357    }
6358
6359    /// The value of [source][crate::model::InputConfig::source]
6360    /// if it holds a `GcsSource`, `None` if the field is not set or
6361    /// holds a different branch.
6362    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
6363        #[allow(unreachable_patterns)]
6364        self.source.as_ref().and_then(|v| match v {
6365            crate::model::input_config::Source::GcsSource(v) => std::option::Option::Some(v),
6366            _ => std::option::Option::None,
6367        })
6368    }
6369
6370    /// Sets the value of [source][crate::model::InputConfig::source]
6371    /// to hold a `GcsSource`.
6372    ///
6373    /// Note that all the setters affecting `source` are
6374    /// mutually exclusive.
6375    ///
6376    /// # Example
6377    /// ```ignore,no_run
6378    /// # use google_cloud_translation_v3::model::InputConfig;
6379    /// use google_cloud_translation_v3::model::GcsSource;
6380    /// let x = InputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
6381    /// assert!(x.gcs_source().is_some());
6382    /// ```
6383    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6384        mut self,
6385        v: T,
6386    ) -> Self {
6387        self.source =
6388            std::option::Option::Some(crate::model::input_config::Source::GcsSource(v.into()));
6389        self
6390    }
6391}
6392
6393impl wkt::message::Message for InputConfig {
6394    fn typename() -> &'static str {
6395        "type.googleapis.com/google.cloud.translation.v3.InputConfig"
6396    }
6397}
6398
6399/// Defines additional types related to [InputConfig].
6400pub mod input_config {
6401    #[allow(unused_imports)]
6402    use super::*;
6403
6404    /// Required. Specify the input.
6405    #[derive(Clone, Debug, PartialEq)]
6406    #[non_exhaustive]
6407    pub enum Source {
6408        /// Required. Google Cloud Storage location for the source input.
6409        /// This can be a single file (for example,
6410        /// `gs://translation-test/input.tsv`) or a wildcard (for example,
6411        /// `gs://translation-test/*`). If a file extension is `.tsv`, it can
6412        /// contain either one or two columns. The first column (optional) is the id
6413        /// of the text request. If the first column is missing, we use the row
6414        /// number (0-based) from the input file as the ID in the output file. The
6415        /// second column is the actual text to be
6416        /// translated. We recommend each row be <= 10K Unicode codepoints,
6417        /// otherwise an error might be returned.
6418        /// Note that the input tsv must be RFC 4180 compliant.
6419        ///
6420        /// You could use <https://github.com/Clever/csvlint> to check potential
6421        /// formatting errors in your tsv file.
6422        /// csvlint --delimiter='\t' your_input_file.tsv
6423        ///
6424        /// The other supported file extensions are `.txt` or `.html`, which is
6425        /// treated as a single large chunk of text.
6426        GcsSource(std::boxed::Box<crate::model::GcsSource>),
6427    }
6428}
6429
6430/// The Google Cloud Storage location for the output content.
6431#[derive(Clone, Default, PartialEq)]
6432#[non_exhaustive]
6433pub struct GcsDestination {
6434    /// Required. The bucket used in 'output_uri_prefix' must exist and there must
6435    /// be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with
6436    /// "/" and start with "gs://". One 'output_uri_prefix' can only be used by one
6437    /// batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error
6438    /// is returned.
6439    pub output_uri_prefix: std::string::String,
6440
6441    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6442}
6443
6444impl GcsDestination {
6445    pub fn new() -> Self {
6446        std::default::Default::default()
6447    }
6448
6449    /// Sets the value of [output_uri_prefix][crate::model::GcsDestination::output_uri_prefix].
6450    ///
6451    /// # Example
6452    /// ```ignore,no_run
6453    /// # use google_cloud_translation_v3::model::GcsDestination;
6454    /// let x = GcsDestination::new().set_output_uri_prefix("example");
6455    /// ```
6456    pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
6457        mut self,
6458        v: T,
6459    ) -> Self {
6460        self.output_uri_prefix = v.into();
6461        self
6462    }
6463}
6464
6465impl wkt::message::Message for GcsDestination {
6466    fn typename() -> &'static str {
6467        "type.googleapis.com/google.cloud.translation.v3.GcsDestination"
6468    }
6469}
6470
6471/// Output configuration for BatchTranslateText request.
6472#[derive(Clone, Default, PartialEq)]
6473#[non_exhaustive]
6474pub struct OutputConfig {
6475    /// Required. The destination of output.
6476    pub destination: std::option::Option<crate::model::output_config::Destination>,
6477
6478    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6479}
6480
6481impl OutputConfig {
6482    pub fn new() -> Self {
6483        std::default::Default::default()
6484    }
6485
6486    /// Sets the value of [destination][crate::model::OutputConfig::destination].
6487    ///
6488    /// Note that all the setters affecting `destination` are mutually
6489    /// exclusive.
6490    ///
6491    /// # Example
6492    /// ```ignore,no_run
6493    /// # use google_cloud_translation_v3::model::OutputConfig;
6494    /// use google_cloud_translation_v3::model::GcsDestination;
6495    /// let x = OutputConfig::new().set_destination(Some(
6496    ///     google_cloud_translation_v3::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
6497    /// ```
6498    pub fn set_destination<
6499        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
6500    >(
6501        mut self,
6502        v: T,
6503    ) -> Self {
6504        self.destination = v.into();
6505        self
6506    }
6507
6508    /// The value of [destination][crate::model::OutputConfig::destination]
6509    /// if it holds a `GcsDestination`, `None` if the field is not set or
6510    /// holds a different branch.
6511    pub fn gcs_destination(
6512        &self,
6513    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
6514        #[allow(unreachable_patterns)]
6515        self.destination.as_ref().and_then(|v| match v {
6516            crate::model::output_config::Destination::GcsDestination(v) => {
6517                std::option::Option::Some(v)
6518            }
6519            _ => std::option::Option::None,
6520        })
6521    }
6522
6523    /// Sets the value of [destination][crate::model::OutputConfig::destination]
6524    /// to hold a `GcsDestination`.
6525    ///
6526    /// Note that all the setters affecting `destination` are
6527    /// mutually exclusive.
6528    ///
6529    /// # Example
6530    /// ```ignore,no_run
6531    /// # use google_cloud_translation_v3::model::OutputConfig;
6532    /// use google_cloud_translation_v3::model::GcsDestination;
6533    /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
6534    /// assert!(x.gcs_destination().is_some());
6535    /// ```
6536    pub fn set_gcs_destination<
6537        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
6538    >(
6539        mut self,
6540        v: T,
6541    ) -> Self {
6542        self.destination = std::option::Option::Some(
6543            crate::model::output_config::Destination::GcsDestination(v.into()),
6544        );
6545        self
6546    }
6547}
6548
6549impl wkt::message::Message for OutputConfig {
6550    fn typename() -> &'static str {
6551        "type.googleapis.com/google.cloud.translation.v3.OutputConfig"
6552    }
6553}
6554
6555/// Defines additional types related to [OutputConfig].
6556pub mod output_config {
6557    #[allow(unused_imports)]
6558    use super::*;
6559
6560    /// Required. The destination of output.
6561    #[derive(Clone, Debug, PartialEq)]
6562    #[non_exhaustive]
6563    pub enum Destination {
6564        /// Google Cloud Storage destination for output content.
6565        /// For every single input file (for example, gs://a/b/c.[extension]), we
6566        /// generate at most 2 * n output files. (n is the # of target_language_codes
6567        /// in the BatchTranslateTextRequest).
6568        ///
6569        /// Output files (tsv) generated are compliant with RFC 4180 except that
6570        /// record delimiters are '\n' instead of '\r\n'. We don't provide any way to
6571        /// change record delimiters.
6572        ///
6573        /// While the input files are being processed, we write/update an index file
6574        /// 'index.csv'  under 'output_uri_prefix' (for example,
6575        /// gs://translation-test/index.csv) The index file is generated/updated as
6576        /// new files are being translated. The format is:
6577        ///
6578        /// input_file,target_language_code,translations_file,errors_file,
6579        /// glossary_translations_file,glossary_errors_file
6580        ///
6581        /// input_file is one file we matched using gcs_source.input_uri.
6582        /// target_language_code is provided in the request.
6583        /// translations_file contains the translations. (details provided below)
6584        /// errors_file contains the errors during processing of the file. (details
6585        /// below). Both translations_file and errors_file could be empty
6586        /// strings if we have no content to output.
6587        /// glossary_translations_file and glossary_errors_file are always empty
6588        /// strings if the input_file is tsv. They could also be empty if we have no
6589        /// content to output.
6590        ///
6591        /// Once a row is present in index.csv, the input/output matching never
6592        /// changes. Callers should also expect all the content in input_file are
6593        /// processed and ready to be consumed (that is, no partial output file is
6594        /// written).
6595        ///
6596        /// Since index.csv will be keeping updated during the process, please make
6597        /// sure there is no custom retention policy applied on the output bucket
6598        /// that may avoid file updating.
6599        /// (<https://cloud.google.com/storage/docs/bucket-lock#retention-policy>)
6600        ///
6601        /// The format of translations_file (for target language code 'trg') is:
6602        /// `gs://translation_test/a_b_c_'trg'_translations.[extension]`
6603        ///
6604        /// If the input file extension is tsv, the output has the following
6605        /// columns:
6606        /// Column 1: ID of the request provided in the input, if it's not
6607        /// provided in the input, then the input row number is used (0-based).
6608        /// Column 2: source sentence.
6609        /// Column 3: translation without applying a glossary. Empty string if there
6610        /// is an error.
6611        /// Column 4 (only present if a glossary is provided in the request):
6612        /// translation after applying the glossary. Empty string if there is an
6613        /// error applying the glossary. Could be same string as column 3 if there is
6614        /// no glossary applied.
6615        ///
6616        /// If input file extension is a txt or html, the translation is directly
6617        /// written to the output file. If glossary is requested, a separate
6618        /// glossary_translations_file has format of
6619        /// `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]`
6620        ///
6621        /// The format of errors file (for target language code 'trg') is:
6622        /// `gs://translation_test/a_b_c_'trg'_errors.[extension]`
6623        ///
6624        /// If the input file extension is tsv, errors_file contains the following:
6625        /// Column 1: ID of the request provided in the input, if it's not
6626        /// provided in the input, then the input row number is used (0-based).
6627        /// Column 2: source sentence.
6628        /// Column 3: Error detail for the translation. Could be empty.
6629        /// Column 4 (only present if a glossary is provided in the request):
6630        /// Error when applying the glossary.
6631        ///
6632        /// If the input file extension is txt or html, glossary_error_file will be
6633        /// generated that contains error details. glossary_error_file has format of
6634        /// `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]`
6635        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
6636    }
6637}
6638
6639/// A document translation request input config.
6640#[derive(Clone, Default, PartialEq)]
6641#[non_exhaustive]
6642pub struct DocumentInputConfig {
6643    /// Specifies the input document's mime_type.
6644    ///
6645    /// If not specified it will be determined using the file extension for
6646    /// gcs_source provided files. For a file provided through bytes content the
6647    /// mime_type must be provided.
6648    /// Currently supported mime types are:
6649    ///
6650    /// - application/pdf
6651    /// - application/vnd.openxmlformats-officedocument.wordprocessingml.document
6652    /// - application/vnd.openxmlformats-officedocument.presentationml.presentation
6653    /// - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
6654    pub mime_type: std::string::String,
6655
6656    /// Specifies the source for the document's content.
6657    /// The input file size should be <= 20MB for
6658    ///
6659    /// - application/vnd.openxmlformats-officedocument.wordprocessingml.document
6660    /// - application/vnd.openxmlformats-officedocument.presentationml.presentation
6661    /// - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
6662    ///   The input file size should be <= 20MB and the maximum page limit is 20 for
6663    /// - application/pdf
6664    pub source: std::option::Option<crate::model::document_input_config::Source>,
6665
6666    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6667}
6668
6669impl DocumentInputConfig {
6670    pub fn new() -> Self {
6671        std::default::Default::default()
6672    }
6673
6674    /// Sets the value of [mime_type][crate::model::DocumentInputConfig::mime_type].
6675    ///
6676    /// # Example
6677    /// ```ignore,no_run
6678    /// # use google_cloud_translation_v3::model::DocumentInputConfig;
6679    /// let x = DocumentInputConfig::new().set_mime_type("example");
6680    /// ```
6681    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6682        self.mime_type = v.into();
6683        self
6684    }
6685
6686    /// Sets the value of [source][crate::model::DocumentInputConfig::source].
6687    ///
6688    /// Note that all the setters affecting `source` are mutually
6689    /// exclusive.
6690    ///
6691    /// # Example
6692    /// ```ignore,no_run
6693    /// # use google_cloud_translation_v3::model::DocumentInputConfig;
6694    /// use google_cloud_translation_v3::model::document_input_config::Source;
6695    /// let x = DocumentInputConfig::new().set_source(Some(Source::Content(bytes::Bytes::from_static(b"example"))));
6696    /// ```
6697    pub fn set_source<
6698        T: std::convert::Into<std::option::Option<crate::model::document_input_config::Source>>,
6699    >(
6700        mut self,
6701        v: T,
6702    ) -> Self {
6703        self.source = v.into();
6704        self
6705    }
6706
6707    /// The value of [source][crate::model::DocumentInputConfig::source]
6708    /// if it holds a `Content`, `None` if the field is not set or
6709    /// holds a different branch.
6710    pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
6711        #[allow(unreachable_patterns)]
6712        self.source.as_ref().and_then(|v| match v {
6713            crate::model::document_input_config::Source::Content(v) => std::option::Option::Some(v),
6714            _ => std::option::Option::None,
6715        })
6716    }
6717
6718    /// Sets the value of [source][crate::model::DocumentInputConfig::source]
6719    /// to hold a `Content`.
6720    ///
6721    /// Note that all the setters affecting `source` are
6722    /// mutually exclusive.
6723    ///
6724    /// # Example
6725    /// ```ignore,no_run
6726    /// # use google_cloud_translation_v3::model::DocumentInputConfig;
6727    /// let x = DocumentInputConfig::new().set_content(bytes::Bytes::from_static(b"example"));
6728    /// assert!(x.content().is_some());
6729    /// assert!(x.gcs_source().is_none());
6730    /// ```
6731    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6732        self.source = std::option::Option::Some(
6733            crate::model::document_input_config::Source::Content(v.into()),
6734        );
6735        self
6736    }
6737
6738    /// The value of [source][crate::model::DocumentInputConfig::source]
6739    /// if it holds a `GcsSource`, `None` if the field is not set or
6740    /// holds a different branch.
6741    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
6742        #[allow(unreachable_patterns)]
6743        self.source.as_ref().and_then(|v| match v {
6744            crate::model::document_input_config::Source::GcsSource(v) => {
6745                std::option::Option::Some(v)
6746            }
6747            _ => std::option::Option::None,
6748        })
6749    }
6750
6751    /// Sets the value of [source][crate::model::DocumentInputConfig::source]
6752    /// to hold a `GcsSource`.
6753    ///
6754    /// Note that all the setters affecting `source` are
6755    /// mutually exclusive.
6756    ///
6757    /// # Example
6758    /// ```ignore,no_run
6759    /// # use google_cloud_translation_v3::model::DocumentInputConfig;
6760    /// use google_cloud_translation_v3::model::GcsSource;
6761    /// let x = DocumentInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
6762    /// assert!(x.gcs_source().is_some());
6763    /// assert!(x.content().is_none());
6764    /// ```
6765    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6766        mut self,
6767        v: T,
6768    ) -> Self {
6769        self.source = std::option::Option::Some(
6770            crate::model::document_input_config::Source::GcsSource(v.into()),
6771        );
6772        self
6773    }
6774}
6775
6776impl wkt::message::Message for DocumentInputConfig {
6777    fn typename() -> &'static str {
6778        "type.googleapis.com/google.cloud.translation.v3.DocumentInputConfig"
6779    }
6780}
6781
6782/// Defines additional types related to [DocumentInputConfig].
6783pub mod document_input_config {
6784    #[allow(unused_imports)]
6785    use super::*;
6786
6787    /// Specifies the source for the document's content.
6788    /// The input file size should be <= 20MB for
6789    ///
6790    /// - application/vnd.openxmlformats-officedocument.wordprocessingml.document
6791    /// - application/vnd.openxmlformats-officedocument.presentationml.presentation
6792    /// - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
6793    ///   The input file size should be <= 20MB and the maximum page limit is 20 for
6794    /// - application/pdf
6795    #[derive(Clone, Debug, PartialEq)]
6796    #[non_exhaustive]
6797    pub enum Source {
6798        /// Document's content represented as a stream of bytes.
6799        Content(::bytes::Bytes),
6800        /// Google Cloud Storage location. This must be a single file.
6801        /// For example: gs://example_bucket/example_file.pdf
6802        GcsSource(std::boxed::Box<crate::model::GcsSource>),
6803    }
6804}
6805
6806/// A document translation request output config.
6807#[derive(Clone, Default, PartialEq)]
6808#[non_exhaustive]
6809pub struct DocumentOutputConfig {
6810    /// Optional. Specifies the translated document's mime_type.
6811    /// If not specified, the translated file's mime type will be the same as the
6812    /// input file's mime type.
6813    /// Currently only support the output mime type to be the same as input mime
6814    /// type.
6815    ///
6816    /// - application/pdf
6817    /// - application/vnd.openxmlformats-officedocument.wordprocessingml.document
6818    /// - application/vnd.openxmlformats-officedocument.presentationml.presentation
6819    /// - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
6820    pub mime_type: std::string::String,
6821
6822    /// A URI destination for the translated document.
6823    /// It is optional to provide a destination. If provided the results from
6824    /// TranslateDocument will be stored in the destination.
6825    /// Whether a destination is provided or not, the translated documents will be
6826    /// returned within TranslateDocumentResponse.document_translation and
6827    /// TranslateDocumentResponse.glossary_document_translation.
6828    pub destination: std::option::Option<crate::model::document_output_config::Destination>,
6829
6830    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6831}
6832
6833impl DocumentOutputConfig {
6834    pub fn new() -> Self {
6835        std::default::Default::default()
6836    }
6837
6838    /// Sets the value of [mime_type][crate::model::DocumentOutputConfig::mime_type].
6839    ///
6840    /// # Example
6841    /// ```ignore,no_run
6842    /// # use google_cloud_translation_v3::model::DocumentOutputConfig;
6843    /// let x = DocumentOutputConfig::new().set_mime_type("example");
6844    /// ```
6845    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6846        self.mime_type = v.into();
6847        self
6848    }
6849
6850    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
6851    ///
6852    /// Note that all the setters affecting `destination` are mutually
6853    /// exclusive.
6854    ///
6855    /// # Example
6856    /// ```ignore,no_run
6857    /// # use google_cloud_translation_v3::model::DocumentOutputConfig;
6858    /// use google_cloud_translation_v3::model::GcsDestination;
6859    /// let x = DocumentOutputConfig::new().set_destination(Some(
6860    ///     google_cloud_translation_v3::model::document_output_config::Destination::GcsDestination(GcsDestination::default().into())));
6861    /// ```
6862    pub fn set_destination<
6863        T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
6864    >(
6865        mut self,
6866        v: T,
6867    ) -> Self {
6868        self.destination = v.into();
6869        self
6870    }
6871
6872    /// The value of [destination][crate::model::DocumentOutputConfig::destination]
6873    /// if it holds a `GcsDestination`, `None` if the field is not set or
6874    /// holds a different branch.
6875    pub fn gcs_destination(
6876        &self,
6877    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
6878        #[allow(unreachable_patterns)]
6879        self.destination.as_ref().and_then(|v| match v {
6880            crate::model::document_output_config::Destination::GcsDestination(v) => {
6881                std::option::Option::Some(v)
6882            }
6883            _ => std::option::Option::None,
6884        })
6885    }
6886
6887    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
6888    /// to hold a `GcsDestination`.
6889    ///
6890    /// Note that all the setters affecting `destination` are
6891    /// mutually exclusive.
6892    ///
6893    /// # Example
6894    /// ```ignore,no_run
6895    /// # use google_cloud_translation_v3::model::DocumentOutputConfig;
6896    /// use google_cloud_translation_v3::model::GcsDestination;
6897    /// let x = DocumentOutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
6898    /// assert!(x.gcs_destination().is_some());
6899    /// ```
6900    pub fn set_gcs_destination<
6901        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
6902    >(
6903        mut self,
6904        v: T,
6905    ) -> Self {
6906        self.destination = std::option::Option::Some(
6907            crate::model::document_output_config::Destination::GcsDestination(v.into()),
6908        );
6909        self
6910    }
6911}
6912
6913impl wkt::message::Message for DocumentOutputConfig {
6914    fn typename() -> &'static str {
6915        "type.googleapis.com/google.cloud.translation.v3.DocumentOutputConfig"
6916    }
6917}
6918
6919/// Defines additional types related to [DocumentOutputConfig].
6920pub mod document_output_config {
6921    #[allow(unused_imports)]
6922    use super::*;
6923
6924    /// A URI destination for the translated document.
6925    /// It is optional to provide a destination. If provided the results from
6926    /// TranslateDocument will be stored in the destination.
6927    /// Whether a destination is provided or not, the translated documents will be
6928    /// returned within TranslateDocumentResponse.document_translation and
6929    /// TranslateDocumentResponse.glossary_document_translation.
6930    #[derive(Clone, Debug, PartialEq)]
6931    #[non_exhaustive]
6932    pub enum Destination {
6933        /// Optional. Google Cloud Storage destination for the translation output,
6934        /// e.g., `gs://my_bucket/my_directory/`.
6935        ///
6936        /// The destination directory provided does not have to be empty, but the
6937        /// bucket must exist. If a file with the same name as the output file
6938        /// already exists in the destination an error will be returned.
6939        ///
6940        /// For a DocumentInputConfig.contents provided document, the output file
6941        /// will have the name "output_[trg]_translations.[ext]", where
6942        ///
6943        /// - [trg] corresponds to the translated file's language code,
6944        /// - [ext] corresponds to the translated file's extension according to its
6945        ///   mime type.
6946        ///
6947        /// For a DocumentInputConfig.gcs_uri provided document, the output file will
6948        /// have a name according to its URI. For example: an input file with URI:
6949        /// `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name
6950        /// "my_bucket" will have an output URI:
6951        /// `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where
6952        ///
6953        /// - [trg] corresponds to the translated file's language code,
6954        /// - [ext] corresponds to the translated file's extension according to its
6955        ///   mime type.
6956        ///
6957        /// If the document was directly provided through the request, then the
6958        /// output document will have the format:
6959        /// `gs://my_bucket/translated_document_[trg]_translations.[ext]`, where
6960        ///
6961        /// - [trg] corresponds to the translated file's language code,
6962        /// - [ext] corresponds to the translated file's extension according to its
6963        ///   mime type.
6964        ///
6965        /// If a glossary was provided, then the output URI for the glossary
6966        /// translation will be equal to the default output URI but have
6967        /// `glossary_translations` instead of `translations`. For the previous
6968        /// example, its glossary URI would be:
6969        /// `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`.
6970        ///
6971        /// Thus the max number of output files will be 2 (Translated document,
6972        /// Glossary translated document).
6973        ///
6974        /// Callers should expect no partial outputs. If there is any error during
6975        /// document translation, no output will be stored in the Cloud Storage
6976        /// bucket.
6977        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
6978    }
6979}
6980
6981/// A document translation request.
6982#[derive(Clone, Default, PartialEq)]
6983#[non_exhaustive]
6984pub struct TranslateDocumentRequest {
6985    /// Required. Location to make a regional call.
6986    ///
6987    /// Format: `projects/{project-number-or-id}/locations/{location-id}`.
6988    ///
6989    /// For global calls, use `projects/{project-number-or-id}/locations/global` or
6990    /// `projects/{project-number-or-id}`.
6991    ///
6992    /// Non-global location is required for requests using AutoML models or custom
6993    /// glossaries.
6994    ///
6995    /// Models and glossaries must be within the same region (have the same
6996    /// location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
6997    pub parent: std::string::String,
6998
6999    /// Optional. The ISO-639 language code of the input document if known, for
7000    /// example, "en-US" or "sr-Latn". Supported language codes are listed in
7001    /// [Language Support](https://cloud.google.com/translate/docs/languages). If
7002    /// the source language isn't specified, the API attempts to identify the
7003    /// source language automatically and returns the source language within the
7004    /// response. Source language must be specified if the request contains a
7005    /// glossary or a custom model.
7006    pub source_language_code: std::string::String,
7007
7008    /// Required. The ISO-639 language code to use for translation of the input
7009    /// document, set to one of the language codes listed in [Language
7010    /// Support](https://cloud.google.com/translate/docs/languages).
7011    pub target_language_code: std::string::String,
7012
7013    /// Required. Input configurations.
7014    pub document_input_config: std::option::Option<crate::model::DocumentInputConfig>,
7015
7016    /// Optional. Output configurations.
7017    /// Defines if the output file should be stored within Cloud Storage as well
7018    /// as the desired output format. If not provided the translated file will
7019    /// only be returned through a byte-stream and its output mime type will be
7020    /// the same as the input file's mime type.
7021    pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
7022
7023    /// Optional. The `model` type requested for this translation.
7024    ///
7025    /// The format depends on model type:
7026    ///
7027    /// - AutoML Translation models:
7028    ///   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
7029    ///
7030    /// - General (built-in) models:
7031    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
7032    ///
7033    ///
7034    /// If not provided, the default Google model (NMT) will be used for
7035    /// translation.
7036    pub model: std::string::String,
7037
7038    /// Optional. Glossary to be applied. The glossary must be within the same
7039    /// region (have the same location-id) as the model, otherwise an
7040    /// INVALID_ARGUMENT (400) error is returned.
7041    pub glossary_config: std::option::Option<crate::model::TranslateTextGlossaryConfig>,
7042
7043    /// Optional. The labels with user-defined metadata for the request.
7044    ///
7045    /// Label keys and values can be no longer than 63 characters (Unicode
7046    /// codepoints), can only contain lowercase letters, numeric characters,
7047    /// underscores and dashes. International characters are allowed. Label values
7048    /// are optional. Label keys must start with a letter.
7049    ///
7050    /// See <https://cloud.google.com/translate/docs/advanced/labels> for more
7051    /// information.
7052    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7053
7054    /// Optional. This flag is to support user customized attribution.
7055    /// If not provided, the default is `Machine Translated by Google`.
7056    /// Customized attribution should follow rules in
7057    /// <https://cloud.google.com/translate/attribution#attribution_and_logos>
7058    pub customized_attribution: std::string::String,
7059
7060    /// Optional. is_translate_native_pdf_only field for external customers.
7061    /// If true, the page limit of online native pdf translation is 300 and only
7062    /// native pdf pages will be translated.
7063    pub is_translate_native_pdf_only: bool,
7064
7065    /// Optional. If true, use the text removal server to remove the shadow text on
7066    /// background image for native pdf translation.
7067    /// Shadow removal feature can only be enabled when
7068    /// is_translate_native_pdf_only: false && pdf_native_only: false
7069    pub enable_shadow_removal_native_pdf: bool,
7070
7071    /// Optional. If true, enable auto rotation correction in DVS.
7072    pub enable_rotation_correction: bool,
7073
7074    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7075}
7076
7077impl TranslateDocumentRequest {
7078    pub fn new() -> Self {
7079        std::default::Default::default()
7080    }
7081
7082    /// Sets the value of [parent][crate::model::TranslateDocumentRequest::parent].
7083    ///
7084    /// # Example
7085    /// ```ignore,no_run
7086    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7087    /// let x = TranslateDocumentRequest::new().set_parent("example");
7088    /// ```
7089    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7090        self.parent = v.into();
7091        self
7092    }
7093
7094    /// Sets the value of [source_language_code][crate::model::TranslateDocumentRequest::source_language_code].
7095    ///
7096    /// # Example
7097    /// ```ignore,no_run
7098    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7099    /// let x = TranslateDocumentRequest::new().set_source_language_code("example");
7100    /// ```
7101    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
7102        mut self,
7103        v: T,
7104    ) -> Self {
7105        self.source_language_code = v.into();
7106        self
7107    }
7108
7109    /// Sets the value of [target_language_code][crate::model::TranslateDocumentRequest::target_language_code].
7110    ///
7111    /// # Example
7112    /// ```ignore,no_run
7113    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7114    /// let x = TranslateDocumentRequest::new().set_target_language_code("example");
7115    /// ```
7116    pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
7117        mut self,
7118        v: T,
7119    ) -> Self {
7120        self.target_language_code = v.into();
7121        self
7122    }
7123
7124    /// Sets the value of [document_input_config][crate::model::TranslateDocumentRequest::document_input_config].
7125    ///
7126    /// # Example
7127    /// ```ignore,no_run
7128    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7129    /// use google_cloud_translation_v3::model::DocumentInputConfig;
7130    /// let x = TranslateDocumentRequest::new().set_document_input_config(DocumentInputConfig::default()/* use setters */);
7131    /// ```
7132    pub fn set_document_input_config<T>(mut self, v: T) -> Self
7133    where
7134        T: std::convert::Into<crate::model::DocumentInputConfig>,
7135    {
7136        self.document_input_config = std::option::Option::Some(v.into());
7137        self
7138    }
7139
7140    /// Sets or clears the value of [document_input_config][crate::model::TranslateDocumentRequest::document_input_config].
7141    ///
7142    /// # Example
7143    /// ```ignore,no_run
7144    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7145    /// use google_cloud_translation_v3::model::DocumentInputConfig;
7146    /// let x = TranslateDocumentRequest::new().set_or_clear_document_input_config(Some(DocumentInputConfig::default()/* use setters */));
7147    /// let x = TranslateDocumentRequest::new().set_or_clear_document_input_config(None::<DocumentInputConfig>);
7148    /// ```
7149    pub fn set_or_clear_document_input_config<T>(mut self, v: std::option::Option<T>) -> Self
7150    where
7151        T: std::convert::Into<crate::model::DocumentInputConfig>,
7152    {
7153        self.document_input_config = v.map(|x| x.into());
7154        self
7155    }
7156
7157    /// Sets the value of [document_output_config][crate::model::TranslateDocumentRequest::document_output_config].
7158    ///
7159    /// # Example
7160    /// ```ignore,no_run
7161    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7162    /// use google_cloud_translation_v3::model::DocumentOutputConfig;
7163    /// let x = TranslateDocumentRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
7164    /// ```
7165    pub fn set_document_output_config<T>(mut self, v: T) -> Self
7166    where
7167        T: std::convert::Into<crate::model::DocumentOutputConfig>,
7168    {
7169        self.document_output_config = std::option::Option::Some(v.into());
7170        self
7171    }
7172
7173    /// Sets or clears the value of [document_output_config][crate::model::TranslateDocumentRequest::document_output_config].
7174    ///
7175    /// # Example
7176    /// ```ignore,no_run
7177    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7178    /// use google_cloud_translation_v3::model::DocumentOutputConfig;
7179    /// let x = TranslateDocumentRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
7180    /// let x = TranslateDocumentRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
7181    /// ```
7182    pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
7183    where
7184        T: std::convert::Into<crate::model::DocumentOutputConfig>,
7185    {
7186        self.document_output_config = v.map(|x| x.into());
7187        self
7188    }
7189
7190    /// Sets the value of [model][crate::model::TranslateDocumentRequest::model].
7191    ///
7192    /// # Example
7193    /// ```ignore,no_run
7194    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7195    /// let x = TranslateDocumentRequest::new().set_model("example");
7196    /// ```
7197    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7198        self.model = v.into();
7199        self
7200    }
7201
7202    /// Sets the value of [glossary_config][crate::model::TranslateDocumentRequest::glossary_config].
7203    ///
7204    /// # Example
7205    /// ```ignore,no_run
7206    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7207    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
7208    /// let x = TranslateDocumentRequest::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);
7209    /// ```
7210    pub fn set_glossary_config<T>(mut self, v: T) -> Self
7211    where
7212        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
7213    {
7214        self.glossary_config = std::option::Option::Some(v.into());
7215        self
7216    }
7217
7218    /// Sets or clears the value of [glossary_config][crate::model::TranslateDocumentRequest::glossary_config].
7219    ///
7220    /// # Example
7221    /// ```ignore,no_run
7222    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7223    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
7224    /// let x = TranslateDocumentRequest::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
7225    /// let x = TranslateDocumentRequest::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);
7226    /// ```
7227    pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
7228    where
7229        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
7230    {
7231        self.glossary_config = v.map(|x| x.into());
7232        self
7233    }
7234
7235    /// Sets the value of [labels][crate::model::TranslateDocumentRequest::labels].
7236    ///
7237    /// # Example
7238    /// ```ignore,no_run
7239    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7240    /// let x = TranslateDocumentRequest::new().set_labels([
7241    ///     ("key0", "abc"),
7242    ///     ("key1", "xyz"),
7243    /// ]);
7244    /// ```
7245    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7246    where
7247        T: std::iter::IntoIterator<Item = (K, V)>,
7248        K: std::convert::Into<std::string::String>,
7249        V: std::convert::Into<std::string::String>,
7250    {
7251        use std::iter::Iterator;
7252        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7253        self
7254    }
7255
7256    /// Sets the value of [customized_attribution][crate::model::TranslateDocumentRequest::customized_attribution].
7257    ///
7258    /// # Example
7259    /// ```ignore,no_run
7260    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7261    /// let x = TranslateDocumentRequest::new().set_customized_attribution("example");
7262    /// ```
7263    pub fn set_customized_attribution<T: std::convert::Into<std::string::String>>(
7264        mut self,
7265        v: T,
7266    ) -> Self {
7267        self.customized_attribution = v.into();
7268        self
7269    }
7270
7271    /// Sets the value of [is_translate_native_pdf_only][crate::model::TranslateDocumentRequest::is_translate_native_pdf_only].
7272    ///
7273    /// # Example
7274    /// ```ignore,no_run
7275    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7276    /// let x = TranslateDocumentRequest::new().set_is_translate_native_pdf_only(true);
7277    /// ```
7278    pub fn set_is_translate_native_pdf_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7279        self.is_translate_native_pdf_only = v.into();
7280        self
7281    }
7282
7283    /// Sets the value of [enable_shadow_removal_native_pdf][crate::model::TranslateDocumentRequest::enable_shadow_removal_native_pdf].
7284    ///
7285    /// # Example
7286    /// ```ignore,no_run
7287    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7288    /// let x = TranslateDocumentRequest::new().set_enable_shadow_removal_native_pdf(true);
7289    /// ```
7290    pub fn set_enable_shadow_removal_native_pdf<T: std::convert::Into<bool>>(
7291        mut self,
7292        v: T,
7293    ) -> Self {
7294        self.enable_shadow_removal_native_pdf = v.into();
7295        self
7296    }
7297
7298    /// Sets the value of [enable_rotation_correction][crate::model::TranslateDocumentRequest::enable_rotation_correction].
7299    ///
7300    /// # Example
7301    /// ```ignore,no_run
7302    /// # use google_cloud_translation_v3::model::TranslateDocumentRequest;
7303    /// let x = TranslateDocumentRequest::new().set_enable_rotation_correction(true);
7304    /// ```
7305    pub fn set_enable_rotation_correction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7306        self.enable_rotation_correction = v.into();
7307        self
7308    }
7309}
7310
7311impl wkt::message::Message for TranslateDocumentRequest {
7312    fn typename() -> &'static str {
7313        "type.googleapis.com/google.cloud.translation.v3.TranslateDocumentRequest"
7314    }
7315}
7316
7317/// A translated document message.
7318#[derive(Clone, Default, PartialEq)]
7319#[non_exhaustive]
7320pub struct DocumentTranslation {
7321    /// The array of translated documents. It is expected to be size 1 for now. We
7322    /// may produce multiple translated documents in the future for other type of
7323    /// file formats.
7324    pub byte_stream_outputs: std::vec::Vec<::bytes::Bytes>,
7325
7326    /// The translated document's mime type.
7327    pub mime_type: std::string::String,
7328
7329    /// The detected language for the input document.
7330    /// If the user did not provide the source language for the input document,
7331    /// this field will have the language code automatically detected. If the
7332    /// source language was passed, auto-detection of the language does not occur
7333    /// and this field is empty.
7334    pub detected_language_code: std::string::String,
7335
7336    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7337}
7338
7339impl DocumentTranslation {
7340    pub fn new() -> Self {
7341        std::default::Default::default()
7342    }
7343
7344    /// Sets the value of [byte_stream_outputs][crate::model::DocumentTranslation::byte_stream_outputs].
7345    ///
7346    /// # Example
7347    /// ```ignore,no_run
7348    /// # use google_cloud_translation_v3::model::DocumentTranslation;
7349    /// let b1 = bytes::Bytes::from_static(b"abc");
7350    /// let b2 = bytes::Bytes::from_static(b"xyz");
7351    /// let x = DocumentTranslation::new().set_byte_stream_outputs([b1, b2]);
7352    /// ```
7353    pub fn set_byte_stream_outputs<T, V>(mut self, v: T) -> Self
7354    where
7355        T: std::iter::IntoIterator<Item = V>,
7356        V: std::convert::Into<::bytes::Bytes>,
7357    {
7358        use std::iter::Iterator;
7359        self.byte_stream_outputs = v.into_iter().map(|i| i.into()).collect();
7360        self
7361    }
7362
7363    /// Sets the value of [mime_type][crate::model::DocumentTranslation::mime_type].
7364    ///
7365    /// # Example
7366    /// ```ignore,no_run
7367    /// # use google_cloud_translation_v3::model::DocumentTranslation;
7368    /// let x = DocumentTranslation::new().set_mime_type("example");
7369    /// ```
7370    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7371        self.mime_type = v.into();
7372        self
7373    }
7374
7375    /// Sets the value of [detected_language_code][crate::model::DocumentTranslation::detected_language_code].
7376    ///
7377    /// # Example
7378    /// ```ignore,no_run
7379    /// # use google_cloud_translation_v3::model::DocumentTranslation;
7380    /// let x = DocumentTranslation::new().set_detected_language_code("example");
7381    /// ```
7382    pub fn set_detected_language_code<T: std::convert::Into<std::string::String>>(
7383        mut self,
7384        v: T,
7385    ) -> Self {
7386        self.detected_language_code = v.into();
7387        self
7388    }
7389}
7390
7391impl wkt::message::Message for DocumentTranslation {
7392    fn typename() -> &'static str {
7393        "type.googleapis.com/google.cloud.translation.v3.DocumentTranslation"
7394    }
7395}
7396
7397/// A translated document response message.
7398#[derive(Clone, Default, PartialEq)]
7399#[non_exhaustive]
7400pub struct TranslateDocumentResponse {
7401    /// Translated document.
7402    pub document_translation: std::option::Option<crate::model::DocumentTranslation>,
7403
7404    /// The document's translation output if a glossary is provided in the request.
7405    /// This can be the same as [TranslateDocumentResponse.document_translation]
7406    /// if no glossary terms apply.
7407    pub glossary_document_translation: std::option::Option<crate::model::DocumentTranslation>,
7408
7409    /// Only present when 'model' is present in the request.
7410    /// 'model' is normalized to have a project number.
7411    ///
7412    /// For example:
7413    /// If the 'model' field in TranslateDocumentRequest is:
7414    /// `projects/{project-id}/locations/{location-id}/models/general/nmt` then
7415    /// `model` here would be normalized to
7416    /// `projects/{project-number}/locations/{location-id}/models/general/nmt`.
7417    pub model: std::string::String,
7418
7419    /// The `glossary_config` used for this translation.
7420    pub glossary_config: std::option::Option<crate::model::TranslateTextGlossaryConfig>,
7421
7422    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7423}
7424
7425impl TranslateDocumentResponse {
7426    pub fn new() -> Self {
7427        std::default::Default::default()
7428    }
7429
7430    /// Sets the value of [document_translation][crate::model::TranslateDocumentResponse::document_translation].
7431    ///
7432    /// # Example
7433    /// ```ignore,no_run
7434    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7435    /// use google_cloud_translation_v3::model::DocumentTranslation;
7436    /// let x = TranslateDocumentResponse::new().set_document_translation(DocumentTranslation::default()/* use setters */);
7437    /// ```
7438    pub fn set_document_translation<T>(mut self, v: T) -> Self
7439    where
7440        T: std::convert::Into<crate::model::DocumentTranslation>,
7441    {
7442        self.document_translation = std::option::Option::Some(v.into());
7443        self
7444    }
7445
7446    /// Sets or clears the value of [document_translation][crate::model::TranslateDocumentResponse::document_translation].
7447    ///
7448    /// # Example
7449    /// ```ignore,no_run
7450    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7451    /// use google_cloud_translation_v3::model::DocumentTranslation;
7452    /// let x = TranslateDocumentResponse::new().set_or_clear_document_translation(Some(DocumentTranslation::default()/* use setters */));
7453    /// let x = TranslateDocumentResponse::new().set_or_clear_document_translation(None::<DocumentTranslation>);
7454    /// ```
7455    pub fn set_or_clear_document_translation<T>(mut self, v: std::option::Option<T>) -> Self
7456    where
7457        T: std::convert::Into<crate::model::DocumentTranslation>,
7458    {
7459        self.document_translation = v.map(|x| x.into());
7460        self
7461    }
7462
7463    /// Sets the value of [glossary_document_translation][crate::model::TranslateDocumentResponse::glossary_document_translation].
7464    ///
7465    /// # Example
7466    /// ```ignore,no_run
7467    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7468    /// use google_cloud_translation_v3::model::DocumentTranslation;
7469    /// let x = TranslateDocumentResponse::new().set_glossary_document_translation(DocumentTranslation::default()/* use setters */);
7470    /// ```
7471    pub fn set_glossary_document_translation<T>(mut self, v: T) -> Self
7472    where
7473        T: std::convert::Into<crate::model::DocumentTranslation>,
7474    {
7475        self.glossary_document_translation = std::option::Option::Some(v.into());
7476        self
7477    }
7478
7479    /// Sets or clears the value of [glossary_document_translation][crate::model::TranslateDocumentResponse::glossary_document_translation].
7480    ///
7481    /// # Example
7482    /// ```ignore,no_run
7483    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7484    /// use google_cloud_translation_v3::model::DocumentTranslation;
7485    /// let x = TranslateDocumentResponse::new().set_or_clear_glossary_document_translation(Some(DocumentTranslation::default()/* use setters */));
7486    /// let x = TranslateDocumentResponse::new().set_or_clear_glossary_document_translation(None::<DocumentTranslation>);
7487    /// ```
7488    pub fn set_or_clear_glossary_document_translation<T>(
7489        mut self,
7490        v: std::option::Option<T>,
7491    ) -> Self
7492    where
7493        T: std::convert::Into<crate::model::DocumentTranslation>,
7494    {
7495        self.glossary_document_translation = v.map(|x| x.into());
7496        self
7497    }
7498
7499    /// Sets the value of [model][crate::model::TranslateDocumentResponse::model].
7500    ///
7501    /// # Example
7502    /// ```ignore,no_run
7503    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7504    /// let x = TranslateDocumentResponse::new().set_model("example");
7505    /// ```
7506    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7507        self.model = v.into();
7508        self
7509    }
7510
7511    /// Sets the value of [glossary_config][crate::model::TranslateDocumentResponse::glossary_config].
7512    ///
7513    /// # Example
7514    /// ```ignore,no_run
7515    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7516    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
7517    /// let x = TranslateDocumentResponse::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);
7518    /// ```
7519    pub fn set_glossary_config<T>(mut self, v: T) -> Self
7520    where
7521        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
7522    {
7523        self.glossary_config = std::option::Option::Some(v.into());
7524        self
7525    }
7526
7527    /// Sets or clears the value of [glossary_config][crate::model::TranslateDocumentResponse::glossary_config].
7528    ///
7529    /// # Example
7530    /// ```ignore,no_run
7531    /// # use google_cloud_translation_v3::model::TranslateDocumentResponse;
7532    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
7533    /// let x = TranslateDocumentResponse::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
7534    /// let x = TranslateDocumentResponse::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);
7535    /// ```
7536    pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
7537    where
7538        T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
7539    {
7540        self.glossary_config = v.map(|x| x.into());
7541        self
7542    }
7543}
7544
7545impl wkt::message::Message for TranslateDocumentResponse {
7546    fn typename() -> &'static str {
7547        "type.googleapis.com/google.cloud.translation.v3.TranslateDocumentResponse"
7548    }
7549}
7550
7551/// The batch translation request.
7552#[derive(Clone, Default, PartialEq)]
7553#[non_exhaustive]
7554pub struct BatchTranslateTextRequest {
7555    /// Required. Location to make a call. Must refer to a caller's project.
7556    ///
7557    /// Format: `projects/{project-number-or-id}/locations/{location-id}`.
7558    ///
7559    /// The `global` location is not supported for batch translation.
7560    ///
7561    /// Only AutoML Translation models or glossaries within the same region (have
7562    /// the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
7563    /// error is returned.
7564    pub parent: std::string::String,
7565
7566    /// Required. Source language code. Supported language codes are listed in
7567    /// [Language
7568    /// Support](https://cloud.google.com/translate/docs/languages).
7569    pub source_language_code: std::string::String,
7570
7571    /// Required. Specify up to 10 language codes here. Supported language codes
7572    /// are listed in [Language
7573    /// Support](https://cloud.google.com/translate/docs/languages).
7574    pub target_language_codes: std::vec::Vec<std::string::String>,
7575
7576    /// Optional. The models to use for translation. Map's key is target language
7577    /// code. Map's value is model name. Value can be a built-in general model,
7578    /// or an AutoML Translation model.
7579    ///
7580    /// The value format depends on model type:
7581    ///
7582    /// - AutoML Translation models:
7583    ///   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
7584    ///
7585    /// - General (built-in) models:
7586    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
7587    ///
7588    ///
7589    /// If the map is empty or a specific model is
7590    /// not requested for a language pair, then default google model (nmt) is used.
7591    pub models: std::collections::HashMap<std::string::String, std::string::String>,
7592
7593    /// Required. Input configurations.
7594    /// The total number of files matched should be <= 100.
7595    /// The total content size should be <= 100M Unicode codepoints.
7596    /// The files must use UTF-8 encoding.
7597    pub input_configs: std::vec::Vec<crate::model::InputConfig>,
7598
7599    /// Required. Output configuration.
7600    /// If 2 input configs match to the same file (that is, same input path),
7601    /// we don't generate output for duplicate inputs.
7602    pub output_config: std::option::Option<crate::model::OutputConfig>,
7603
7604    /// Optional. Glossaries to be applied for translation.
7605    /// It's keyed by target language code.
7606    pub glossaries:
7607        std::collections::HashMap<std::string::String, crate::model::TranslateTextGlossaryConfig>,
7608
7609    /// Optional. The labels with user-defined metadata for the request.
7610    ///
7611    /// Label keys and values can be no longer than 63 characters
7612    /// (Unicode codepoints), can only contain lowercase letters, numeric
7613    /// characters, underscores and dashes. International characters are allowed.
7614    /// Label values are optional. Label keys must start with a letter.
7615    ///
7616    /// See <https://cloud.google.com/translate/docs/advanced/labels> for more
7617    /// information.
7618    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7619
7620    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7621}
7622
7623impl BatchTranslateTextRequest {
7624    pub fn new() -> Self {
7625        std::default::Default::default()
7626    }
7627
7628    /// Sets the value of [parent][crate::model::BatchTranslateTextRequest::parent].
7629    ///
7630    /// # Example
7631    /// ```ignore,no_run
7632    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7633    /// let x = BatchTranslateTextRequest::new().set_parent("example");
7634    /// ```
7635    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7636        self.parent = v.into();
7637        self
7638    }
7639
7640    /// Sets the value of [source_language_code][crate::model::BatchTranslateTextRequest::source_language_code].
7641    ///
7642    /// # Example
7643    /// ```ignore,no_run
7644    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7645    /// let x = BatchTranslateTextRequest::new().set_source_language_code("example");
7646    /// ```
7647    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
7648        mut self,
7649        v: T,
7650    ) -> Self {
7651        self.source_language_code = v.into();
7652        self
7653    }
7654
7655    /// Sets the value of [target_language_codes][crate::model::BatchTranslateTextRequest::target_language_codes].
7656    ///
7657    /// # Example
7658    /// ```ignore,no_run
7659    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7660    /// let x = BatchTranslateTextRequest::new().set_target_language_codes(["a", "b", "c"]);
7661    /// ```
7662    pub fn set_target_language_codes<T, V>(mut self, v: T) -> Self
7663    where
7664        T: std::iter::IntoIterator<Item = V>,
7665        V: std::convert::Into<std::string::String>,
7666    {
7667        use std::iter::Iterator;
7668        self.target_language_codes = v.into_iter().map(|i| i.into()).collect();
7669        self
7670    }
7671
7672    /// Sets the value of [models][crate::model::BatchTranslateTextRequest::models].
7673    ///
7674    /// # Example
7675    /// ```ignore,no_run
7676    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7677    /// let x = BatchTranslateTextRequest::new().set_models([
7678    ///     ("key0", "abc"),
7679    ///     ("key1", "xyz"),
7680    /// ]);
7681    /// ```
7682    pub fn set_models<T, K, V>(mut self, v: T) -> Self
7683    where
7684        T: std::iter::IntoIterator<Item = (K, V)>,
7685        K: std::convert::Into<std::string::String>,
7686        V: std::convert::Into<std::string::String>,
7687    {
7688        use std::iter::Iterator;
7689        self.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7690        self
7691    }
7692
7693    /// Sets the value of [input_configs][crate::model::BatchTranslateTextRequest::input_configs].
7694    ///
7695    /// # Example
7696    /// ```ignore,no_run
7697    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7698    /// use google_cloud_translation_v3::model::InputConfig;
7699    /// let x = BatchTranslateTextRequest::new()
7700    ///     .set_input_configs([
7701    ///         InputConfig::default()/* use setters */,
7702    ///         InputConfig::default()/* use (different) setters */,
7703    ///     ]);
7704    /// ```
7705    pub fn set_input_configs<T, V>(mut self, v: T) -> Self
7706    where
7707        T: std::iter::IntoIterator<Item = V>,
7708        V: std::convert::Into<crate::model::InputConfig>,
7709    {
7710        use std::iter::Iterator;
7711        self.input_configs = v.into_iter().map(|i| i.into()).collect();
7712        self
7713    }
7714
7715    /// Sets the value of [output_config][crate::model::BatchTranslateTextRequest::output_config].
7716    ///
7717    /// # Example
7718    /// ```ignore,no_run
7719    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7720    /// use google_cloud_translation_v3::model::OutputConfig;
7721    /// let x = BatchTranslateTextRequest::new().set_output_config(OutputConfig::default()/* use setters */);
7722    /// ```
7723    pub fn set_output_config<T>(mut self, v: T) -> Self
7724    where
7725        T: std::convert::Into<crate::model::OutputConfig>,
7726    {
7727        self.output_config = std::option::Option::Some(v.into());
7728        self
7729    }
7730
7731    /// Sets or clears the value of [output_config][crate::model::BatchTranslateTextRequest::output_config].
7732    ///
7733    /// # Example
7734    /// ```ignore,no_run
7735    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7736    /// use google_cloud_translation_v3::model::OutputConfig;
7737    /// let x = BatchTranslateTextRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
7738    /// let x = BatchTranslateTextRequest::new().set_or_clear_output_config(None::<OutputConfig>);
7739    /// ```
7740    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
7741    where
7742        T: std::convert::Into<crate::model::OutputConfig>,
7743    {
7744        self.output_config = v.map(|x| x.into());
7745        self
7746    }
7747
7748    /// Sets the value of [glossaries][crate::model::BatchTranslateTextRequest::glossaries].
7749    ///
7750    /// # Example
7751    /// ```ignore,no_run
7752    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7753    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
7754    /// let x = BatchTranslateTextRequest::new().set_glossaries([
7755    ///     ("key0", TranslateTextGlossaryConfig::default()/* use setters */),
7756    ///     ("key1", TranslateTextGlossaryConfig::default()/* use (different) setters */),
7757    /// ]);
7758    /// ```
7759    pub fn set_glossaries<T, K, V>(mut self, v: T) -> Self
7760    where
7761        T: std::iter::IntoIterator<Item = (K, V)>,
7762        K: std::convert::Into<std::string::String>,
7763        V: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
7764    {
7765        use std::iter::Iterator;
7766        self.glossaries = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7767        self
7768    }
7769
7770    /// Sets the value of [labels][crate::model::BatchTranslateTextRequest::labels].
7771    ///
7772    /// # Example
7773    /// ```ignore,no_run
7774    /// # use google_cloud_translation_v3::model::BatchTranslateTextRequest;
7775    /// let x = BatchTranslateTextRequest::new().set_labels([
7776    ///     ("key0", "abc"),
7777    ///     ("key1", "xyz"),
7778    /// ]);
7779    /// ```
7780    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7781    where
7782        T: std::iter::IntoIterator<Item = (K, V)>,
7783        K: std::convert::Into<std::string::String>,
7784        V: std::convert::Into<std::string::String>,
7785    {
7786        use std::iter::Iterator;
7787        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7788        self
7789    }
7790}
7791
7792impl wkt::message::Message for BatchTranslateTextRequest {
7793    fn typename() -> &'static str {
7794        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateTextRequest"
7795    }
7796}
7797
7798/// State metadata for the batch translation operation.
7799#[derive(Clone, Default, PartialEq)]
7800#[non_exhaustive]
7801pub struct BatchTranslateMetadata {
7802    /// The state of the operation.
7803    pub state: crate::model::batch_translate_metadata::State,
7804
7805    /// Number of successfully translated characters so far (Unicode codepoints).
7806    pub translated_characters: i64,
7807
7808    /// Number of characters that have failed to process so far (Unicode
7809    /// codepoints).
7810    pub failed_characters: i64,
7811
7812    /// Total number of characters (Unicode codepoints).
7813    /// This is the total number of codepoints from input files times the number of
7814    /// target languages and appears here shortly after the call is submitted.
7815    pub total_characters: i64,
7816
7817    /// Time when the operation was submitted.
7818    pub submit_time: std::option::Option<wkt::Timestamp>,
7819
7820    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7821}
7822
7823impl BatchTranslateMetadata {
7824    pub fn new() -> Self {
7825        std::default::Default::default()
7826    }
7827
7828    /// Sets the value of [state][crate::model::BatchTranslateMetadata::state].
7829    ///
7830    /// # Example
7831    /// ```ignore,no_run
7832    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7833    /// use google_cloud_translation_v3::model::batch_translate_metadata::State;
7834    /// let x0 = BatchTranslateMetadata::new().set_state(State::Running);
7835    /// let x1 = BatchTranslateMetadata::new().set_state(State::Succeeded);
7836    /// let x2 = BatchTranslateMetadata::new().set_state(State::Failed);
7837    /// ```
7838    pub fn set_state<T: std::convert::Into<crate::model::batch_translate_metadata::State>>(
7839        mut self,
7840        v: T,
7841    ) -> Self {
7842        self.state = v.into();
7843        self
7844    }
7845
7846    /// Sets the value of [translated_characters][crate::model::BatchTranslateMetadata::translated_characters].
7847    ///
7848    /// # Example
7849    /// ```ignore,no_run
7850    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7851    /// let x = BatchTranslateMetadata::new().set_translated_characters(42);
7852    /// ```
7853    pub fn set_translated_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7854        self.translated_characters = v.into();
7855        self
7856    }
7857
7858    /// Sets the value of [failed_characters][crate::model::BatchTranslateMetadata::failed_characters].
7859    ///
7860    /// # Example
7861    /// ```ignore,no_run
7862    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7863    /// let x = BatchTranslateMetadata::new().set_failed_characters(42);
7864    /// ```
7865    pub fn set_failed_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7866        self.failed_characters = v.into();
7867        self
7868    }
7869
7870    /// Sets the value of [total_characters][crate::model::BatchTranslateMetadata::total_characters].
7871    ///
7872    /// # Example
7873    /// ```ignore,no_run
7874    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7875    /// let x = BatchTranslateMetadata::new().set_total_characters(42);
7876    /// ```
7877    pub fn set_total_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7878        self.total_characters = v.into();
7879        self
7880    }
7881
7882    /// Sets the value of [submit_time][crate::model::BatchTranslateMetadata::submit_time].
7883    ///
7884    /// # Example
7885    /// ```ignore,no_run
7886    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7887    /// use wkt::Timestamp;
7888    /// let x = BatchTranslateMetadata::new().set_submit_time(Timestamp::default()/* use setters */);
7889    /// ```
7890    pub fn set_submit_time<T>(mut self, v: T) -> Self
7891    where
7892        T: std::convert::Into<wkt::Timestamp>,
7893    {
7894        self.submit_time = std::option::Option::Some(v.into());
7895        self
7896    }
7897
7898    /// Sets or clears the value of [submit_time][crate::model::BatchTranslateMetadata::submit_time].
7899    ///
7900    /// # Example
7901    /// ```ignore,no_run
7902    /// # use google_cloud_translation_v3::model::BatchTranslateMetadata;
7903    /// use wkt::Timestamp;
7904    /// let x = BatchTranslateMetadata::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
7905    /// let x = BatchTranslateMetadata::new().set_or_clear_submit_time(None::<Timestamp>);
7906    /// ```
7907    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
7908    where
7909        T: std::convert::Into<wkt::Timestamp>,
7910    {
7911        self.submit_time = v.map(|x| x.into());
7912        self
7913    }
7914}
7915
7916impl wkt::message::Message for BatchTranslateMetadata {
7917    fn typename() -> &'static str {
7918        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateMetadata"
7919    }
7920}
7921
7922/// Defines additional types related to [BatchTranslateMetadata].
7923pub mod batch_translate_metadata {
7924    #[allow(unused_imports)]
7925    use super::*;
7926
7927    /// State of the job.
7928    ///
7929    /// # Working with unknown values
7930    ///
7931    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7932    /// additional enum variants at any time. Adding new variants is not considered
7933    /// a breaking change. Applications should write their code in anticipation of:
7934    ///
7935    /// - New values appearing in future releases of the client library, **and**
7936    /// - New values received dynamically, without application changes.
7937    ///
7938    /// Please consult the [Working with enums] section in the user guide for some
7939    /// guidelines.
7940    ///
7941    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7942    #[derive(Clone, Debug, PartialEq)]
7943    #[non_exhaustive]
7944    pub enum State {
7945        /// Invalid.
7946        Unspecified,
7947        /// Request is being processed.
7948        Running,
7949        /// The batch is processed, and at least one item was successfully
7950        /// processed.
7951        Succeeded,
7952        /// The batch is done and no item was successfully processed.
7953        Failed,
7954        /// Request is in the process of being canceled after caller invoked
7955        /// longrunning.Operations.CancelOperation on the request id.
7956        Cancelling,
7957        /// The batch is done after the user has called the
7958        /// longrunning.Operations.CancelOperation. Any records processed before the
7959        /// cancel command are output as specified in the request.
7960        Cancelled,
7961        /// If set, the enum was initialized with an unknown value.
7962        ///
7963        /// Applications can examine the value using [State::value] or
7964        /// [State::name].
7965        UnknownValue(state::UnknownValue),
7966    }
7967
7968    #[doc(hidden)]
7969    pub mod state {
7970        #[allow(unused_imports)]
7971        use super::*;
7972        #[derive(Clone, Debug, PartialEq)]
7973        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7974    }
7975
7976    impl State {
7977        /// Gets the enum value.
7978        ///
7979        /// Returns `None` if the enum contains an unknown value deserialized from
7980        /// the string representation of enums.
7981        pub fn value(&self) -> std::option::Option<i32> {
7982            match self {
7983                Self::Unspecified => std::option::Option::Some(0),
7984                Self::Running => std::option::Option::Some(1),
7985                Self::Succeeded => std::option::Option::Some(2),
7986                Self::Failed => std::option::Option::Some(3),
7987                Self::Cancelling => std::option::Option::Some(4),
7988                Self::Cancelled => std::option::Option::Some(5),
7989                Self::UnknownValue(u) => u.0.value(),
7990            }
7991        }
7992
7993        /// Gets the enum value as a string.
7994        ///
7995        /// Returns `None` if the enum contains an unknown value deserialized from
7996        /// the integer representation of enums.
7997        pub fn name(&self) -> std::option::Option<&str> {
7998            match self {
7999                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8000                Self::Running => std::option::Option::Some("RUNNING"),
8001                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
8002                Self::Failed => std::option::Option::Some("FAILED"),
8003                Self::Cancelling => std::option::Option::Some("CANCELLING"),
8004                Self::Cancelled => std::option::Option::Some("CANCELLED"),
8005                Self::UnknownValue(u) => u.0.name(),
8006            }
8007        }
8008    }
8009
8010    impl std::default::Default for State {
8011        fn default() -> Self {
8012            use std::convert::From;
8013            Self::from(0)
8014        }
8015    }
8016
8017    impl std::fmt::Display for State {
8018        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8019            wkt::internal::display_enum(f, self.name(), self.value())
8020        }
8021    }
8022
8023    impl std::convert::From<i32> for State {
8024        fn from(value: i32) -> Self {
8025            match value {
8026                0 => Self::Unspecified,
8027                1 => Self::Running,
8028                2 => Self::Succeeded,
8029                3 => Self::Failed,
8030                4 => Self::Cancelling,
8031                5 => Self::Cancelled,
8032                _ => Self::UnknownValue(state::UnknownValue(
8033                    wkt::internal::UnknownEnumValue::Integer(value),
8034                )),
8035            }
8036        }
8037    }
8038
8039    impl std::convert::From<&str> for State {
8040        fn from(value: &str) -> Self {
8041            use std::string::ToString;
8042            match value {
8043                "STATE_UNSPECIFIED" => Self::Unspecified,
8044                "RUNNING" => Self::Running,
8045                "SUCCEEDED" => Self::Succeeded,
8046                "FAILED" => Self::Failed,
8047                "CANCELLING" => Self::Cancelling,
8048                "CANCELLED" => Self::Cancelled,
8049                _ => Self::UnknownValue(state::UnknownValue(
8050                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8051                )),
8052            }
8053        }
8054    }
8055
8056    impl serde::ser::Serialize for State {
8057        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8058        where
8059            S: serde::Serializer,
8060        {
8061            match self {
8062                Self::Unspecified => serializer.serialize_i32(0),
8063                Self::Running => serializer.serialize_i32(1),
8064                Self::Succeeded => serializer.serialize_i32(2),
8065                Self::Failed => serializer.serialize_i32(3),
8066                Self::Cancelling => serializer.serialize_i32(4),
8067                Self::Cancelled => serializer.serialize_i32(5),
8068                Self::UnknownValue(u) => u.0.serialize(serializer),
8069            }
8070        }
8071    }
8072
8073    impl<'de> serde::de::Deserialize<'de> for State {
8074        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8075        where
8076            D: serde::Deserializer<'de>,
8077        {
8078            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8079                ".google.cloud.translation.v3.BatchTranslateMetadata.State",
8080            ))
8081        }
8082    }
8083}
8084
8085/// Stored in the
8086/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
8087/// field returned by BatchTranslateText if at least one sentence is translated
8088/// successfully.
8089///
8090/// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
8091#[derive(Clone, Default, PartialEq)]
8092#[non_exhaustive]
8093pub struct BatchTranslateResponse {
8094    /// Total number of characters (Unicode codepoints).
8095    pub total_characters: i64,
8096
8097    /// Number of successfully translated characters (Unicode codepoints).
8098    pub translated_characters: i64,
8099
8100    /// Number of characters that have failed to process (Unicode codepoints).
8101    pub failed_characters: i64,
8102
8103    /// Time when the operation was submitted.
8104    pub submit_time: std::option::Option<wkt::Timestamp>,
8105
8106    /// The time when the operation is finished and
8107    /// [google.longrunning.Operation.done][google.longrunning.Operation.done] is
8108    /// set to true.
8109    ///
8110    /// [google.longrunning.Operation.done]: google_cloud_longrunning::model::Operation::done
8111    pub end_time: std::option::Option<wkt::Timestamp>,
8112
8113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8114}
8115
8116impl BatchTranslateResponse {
8117    pub fn new() -> Self {
8118        std::default::Default::default()
8119    }
8120
8121    /// Sets the value of [total_characters][crate::model::BatchTranslateResponse::total_characters].
8122    ///
8123    /// # Example
8124    /// ```ignore,no_run
8125    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8126    /// let x = BatchTranslateResponse::new().set_total_characters(42);
8127    /// ```
8128    pub fn set_total_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8129        self.total_characters = v.into();
8130        self
8131    }
8132
8133    /// Sets the value of [translated_characters][crate::model::BatchTranslateResponse::translated_characters].
8134    ///
8135    /// # Example
8136    /// ```ignore,no_run
8137    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8138    /// let x = BatchTranslateResponse::new().set_translated_characters(42);
8139    /// ```
8140    pub fn set_translated_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8141        self.translated_characters = v.into();
8142        self
8143    }
8144
8145    /// Sets the value of [failed_characters][crate::model::BatchTranslateResponse::failed_characters].
8146    ///
8147    /// # Example
8148    /// ```ignore,no_run
8149    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8150    /// let x = BatchTranslateResponse::new().set_failed_characters(42);
8151    /// ```
8152    pub fn set_failed_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8153        self.failed_characters = v.into();
8154        self
8155    }
8156
8157    /// Sets the value of [submit_time][crate::model::BatchTranslateResponse::submit_time].
8158    ///
8159    /// # Example
8160    /// ```ignore,no_run
8161    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8162    /// use wkt::Timestamp;
8163    /// let x = BatchTranslateResponse::new().set_submit_time(Timestamp::default()/* use setters */);
8164    /// ```
8165    pub fn set_submit_time<T>(mut self, v: T) -> Self
8166    where
8167        T: std::convert::Into<wkt::Timestamp>,
8168    {
8169        self.submit_time = std::option::Option::Some(v.into());
8170        self
8171    }
8172
8173    /// Sets or clears the value of [submit_time][crate::model::BatchTranslateResponse::submit_time].
8174    ///
8175    /// # Example
8176    /// ```ignore,no_run
8177    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8178    /// use wkt::Timestamp;
8179    /// let x = BatchTranslateResponse::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
8180    /// let x = BatchTranslateResponse::new().set_or_clear_submit_time(None::<Timestamp>);
8181    /// ```
8182    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
8183    where
8184        T: std::convert::Into<wkt::Timestamp>,
8185    {
8186        self.submit_time = v.map(|x| x.into());
8187        self
8188    }
8189
8190    /// Sets the value of [end_time][crate::model::BatchTranslateResponse::end_time].
8191    ///
8192    /// # Example
8193    /// ```ignore,no_run
8194    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8195    /// use wkt::Timestamp;
8196    /// let x = BatchTranslateResponse::new().set_end_time(Timestamp::default()/* use setters */);
8197    /// ```
8198    pub fn set_end_time<T>(mut self, v: T) -> Self
8199    where
8200        T: std::convert::Into<wkt::Timestamp>,
8201    {
8202        self.end_time = std::option::Option::Some(v.into());
8203        self
8204    }
8205
8206    /// Sets or clears the value of [end_time][crate::model::BatchTranslateResponse::end_time].
8207    ///
8208    /// # Example
8209    /// ```ignore,no_run
8210    /// # use google_cloud_translation_v3::model::BatchTranslateResponse;
8211    /// use wkt::Timestamp;
8212    /// let x = BatchTranslateResponse::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
8213    /// let x = BatchTranslateResponse::new().set_or_clear_end_time(None::<Timestamp>);
8214    /// ```
8215    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8216    where
8217        T: std::convert::Into<wkt::Timestamp>,
8218    {
8219        self.end_time = v.map(|x| x.into());
8220        self
8221    }
8222}
8223
8224impl wkt::message::Message for BatchTranslateResponse {
8225    fn typename() -> &'static str {
8226        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateResponse"
8227    }
8228}
8229
8230/// Input configuration for glossaries.
8231#[derive(Clone, Default, PartialEq)]
8232#[non_exhaustive]
8233pub struct GlossaryInputConfig {
8234    /// Required. Specify the input.
8235    pub source: std::option::Option<crate::model::glossary_input_config::Source>,
8236
8237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8238}
8239
8240impl GlossaryInputConfig {
8241    pub fn new() -> Self {
8242        std::default::Default::default()
8243    }
8244
8245    /// Sets the value of [source][crate::model::GlossaryInputConfig::source].
8246    ///
8247    /// Note that all the setters affecting `source` are mutually
8248    /// exclusive.
8249    ///
8250    /// # Example
8251    /// ```ignore,no_run
8252    /// # use google_cloud_translation_v3::model::GlossaryInputConfig;
8253    /// use google_cloud_translation_v3::model::GcsSource;
8254    /// let x = GlossaryInputConfig::new().set_source(Some(
8255    ///     google_cloud_translation_v3::model::glossary_input_config::Source::GcsSource(GcsSource::default().into())));
8256    /// ```
8257    pub fn set_source<
8258        T: std::convert::Into<std::option::Option<crate::model::glossary_input_config::Source>>,
8259    >(
8260        mut self,
8261        v: T,
8262    ) -> Self {
8263        self.source = v.into();
8264        self
8265    }
8266
8267    /// The value of [source][crate::model::GlossaryInputConfig::source]
8268    /// if it holds a `GcsSource`, `None` if the field is not set or
8269    /// holds a different branch.
8270    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
8271        #[allow(unreachable_patterns)]
8272        self.source.as_ref().and_then(|v| match v {
8273            crate::model::glossary_input_config::Source::GcsSource(v) => {
8274                std::option::Option::Some(v)
8275            }
8276            _ => std::option::Option::None,
8277        })
8278    }
8279
8280    /// Sets the value of [source][crate::model::GlossaryInputConfig::source]
8281    /// to hold a `GcsSource`.
8282    ///
8283    /// Note that all the setters affecting `source` are
8284    /// mutually exclusive.
8285    ///
8286    /// # Example
8287    /// ```ignore,no_run
8288    /// # use google_cloud_translation_v3::model::GlossaryInputConfig;
8289    /// use google_cloud_translation_v3::model::GcsSource;
8290    /// let x = GlossaryInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
8291    /// assert!(x.gcs_source().is_some());
8292    /// ```
8293    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
8294        mut self,
8295        v: T,
8296    ) -> Self {
8297        self.source = std::option::Option::Some(
8298            crate::model::glossary_input_config::Source::GcsSource(v.into()),
8299        );
8300        self
8301    }
8302}
8303
8304impl wkt::message::Message for GlossaryInputConfig {
8305    fn typename() -> &'static str {
8306        "type.googleapis.com/google.cloud.translation.v3.GlossaryInputConfig"
8307    }
8308}
8309
8310/// Defines additional types related to [GlossaryInputConfig].
8311pub mod glossary_input_config {
8312    #[allow(unused_imports)]
8313    use super::*;
8314
8315    /// Required. Specify the input.
8316    #[derive(Clone, Debug, PartialEq)]
8317    #[non_exhaustive]
8318    pub enum Source {
8319        /// Required. Google Cloud Storage location of glossary data.
8320        /// File format is determined based on the filename extension. API returns
8321        /// [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
8322        /// formats. Wildcards are not allowed. This must be a single file in one of
8323        /// the following formats:
8324        ///
8325        /// For unidirectional glossaries:
8326        ///
8327        /// - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated.
8328        ///   The first column is source text. The second column is target text.
8329        ///   No headers in this file. The first row contains data and not column
8330        ///   names.
8331        ///
8332        /// - TMX (`.tmx`): TMX file with parallel data defining source/target term
8333        ///   pairs.
8334        ///
8335        ///
8336        /// For equivalent term sets glossaries:
8337        ///
8338        /// - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
8339        ///   in multiple languages. See documentation for more information -
8340        ///   [glossaries](https://cloud.google.com/translate/docs/advanced/glossary).
8341        GcsSource(std::boxed::Box<crate::model::GcsSource>),
8342    }
8343}
8344
8345/// Represents a glossary built from user-provided data.
8346#[derive(Clone, Default, PartialEq)]
8347#[non_exhaustive]
8348pub struct Glossary {
8349    /// Required. The resource name of the glossary. Glossary names have the form
8350    /// `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
8351    pub name: std::string::String,
8352
8353    /// Required. Provides examples to build the glossary from.
8354    /// Total glossary must not exceed 10M Unicode codepoints.
8355    pub input_config: std::option::Option<crate::model::GlossaryInputConfig>,
8356
8357    /// Output only. The number of entries defined in the glossary.
8358    pub entry_count: i32,
8359
8360    /// Output only. When CreateGlossary was called.
8361    pub submit_time: std::option::Option<wkt::Timestamp>,
8362
8363    /// Output only. When the glossary creation was finished.
8364    pub end_time: std::option::Option<wkt::Timestamp>,
8365
8366    /// Optional. The display name of the glossary.
8367    pub display_name: std::string::String,
8368
8369    /// Languages supported by the glossary.
8370    pub languages: std::option::Option<crate::model::glossary::Languages>,
8371
8372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8373}
8374
8375impl Glossary {
8376    pub fn new() -> Self {
8377        std::default::Default::default()
8378    }
8379
8380    /// Sets the value of [name][crate::model::Glossary::name].
8381    ///
8382    /// # Example
8383    /// ```ignore,no_run
8384    /// # use google_cloud_translation_v3::model::Glossary;
8385    /// let x = Glossary::new().set_name("example");
8386    /// ```
8387    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8388        self.name = v.into();
8389        self
8390    }
8391
8392    /// Sets the value of [input_config][crate::model::Glossary::input_config].
8393    ///
8394    /// # Example
8395    /// ```ignore,no_run
8396    /// # use google_cloud_translation_v3::model::Glossary;
8397    /// use google_cloud_translation_v3::model::GlossaryInputConfig;
8398    /// let x = Glossary::new().set_input_config(GlossaryInputConfig::default()/* use setters */);
8399    /// ```
8400    pub fn set_input_config<T>(mut self, v: T) -> Self
8401    where
8402        T: std::convert::Into<crate::model::GlossaryInputConfig>,
8403    {
8404        self.input_config = std::option::Option::Some(v.into());
8405        self
8406    }
8407
8408    /// Sets or clears the value of [input_config][crate::model::Glossary::input_config].
8409    ///
8410    /// # Example
8411    /// ```ignore,no_run
8412    /// # use google_cloud_translation_v3::model::Glossary;
8413    /// use google_cloud_translation_v3::model::GlossaryInputConfig;
8414    /// let x = Glossary::new().set_or_clear_input_config(Some(GlossaryInputConfig::default()/* use setters */));
8415    /// let x = Glossary::new().set_or_clear_input_config(None::<GlossaryInputConfig>);
8416    /// ```
8417    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
8418    where
8419        T: std::convert::Into<crate::model::GlossaryInputConfig>,
8420    {
8421        self.input_config = v.map(|x| x.into());
8422        self
8423    }
8424
8425    /// Sets the value of [entry_count][crate::model::Glossary::entry_count].
8426    ///
8427    /// # Example
8428    /// ```ignore,no_run
8429    /// # use google_cloud_translation_v3::model::Glossary;
8430    /// let x = Glossary::new().set_entry_count(42);
8431    /// ```
8432    pub fn set_entry_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8433        self.entry_count = v.into();
8434        self
8435    }
8436
8437    /// Sets the value of [submit_time][crate::model::Glossary::submit_time].
8438    ///
8439    /// # Example
8440    /// ```ignore,no_run
8441    /// # use google_cloud_translation_v3::model::Glossary;
8442    /// use wkt::Timestamp;
8443    /// let x = Glossary::new().set_submit_time(Timestamp::default()/* use setters */);
8444    /// ```
8445    pub fn set_submit_time<T>(mut self, v: T) -> Self
8446    where
8447        T: std::convert::Into<wkt::Timestamp>,
8448    {
8449        self.submit_time = std::option::Option::Some(v.into());
8450        self
8451    }
8452
8453    /// Sets or clears the value of [submit_time][crate::model::Glossary::submit_time].
8454    ///
8455    /// # Example
8456    /// ```ignore,no_run
8457    /// # use google_cloud_translation_v3::model::Glossary;
8458    /// use wkt::Timestamp;
8459    /// let x = Glossary::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
8460    /// let x = Glossary::new().set_or_clear_submit_time(None::<Timestamp>);
8461    /// ```
8462    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
8463    where
8464        T: std::convert::Into<wkt::Timestamp>,
8465    {
8466        self.submit_time = v.map(|x| x.into());
8467        self
8468    }
8469
8470    /// Sets the value of [end_time][crate::model::Glossary::end_time].
8471    ///
8472    /// # Example
8473    /// ```ignore,no_run
8474    /// # use google_cloud_translation_v3::model::Glossary;
8475    /// use wkt::Timestamp;
8476    /// let x = Glossary::new().set_end_time(Timestamp::default()/* use setters */);
8477    /// ```
8478    pub fn set_end_time<T>(mut self, v: T) -> Self
8479    where
8480        T: std::convert::Into<wkt::Timestamp>,
8481    {
8482        self.end_time = std::option::Option::Some(v.into());
8483        self
8484    }
8485
8486    /// Sets or clears the value of [end_time][crate::model::Glossary::end_time].
8487    ///
8488    /// # Example
8489    /// ```ignore,no_run
8490    /// # use google_cloud_translation_v3::model::Glossary;
8491    /// use wkt::Timestamp;
8492    /// let x = Glossary::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
8493    /// let x = Glossary::new().set_or_clear_end_time(None::<Timestamp>);
8494    /// ```
8495    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8496    where
8497        T: std::convert::Into<wkt::Timestamp>,
8498    {
8499        self.end_time = v.map(|x| x.into());
8500        self
8501    }
8502
8503    /// Sets the value of [display_name][crate::model::Glossary::display_name].
8504    ///
8505    /// # Example
8506    /// ```ignore,no_run
8507    /// # use google_cloud_translation_v3::model::Glossary;
8508    /// let x = Glossary::new().set_display_name("example");
8509    /// ```
8510    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8511        self.display_name = v.into();
8512        self
8513    }
8514
8515    /// Sets the value of [languages][crate::model::Glossary::languages].
8516    ///
8517    /// Note that all the setters affecting `languages` are mutually
8518    /// exclusive.
8519    ///
8520    /// # Example
8521    /// ```ignore,no_run
8522    /// # use google_cloud_translation_v3::model::Glossary;
8523    /// use google_cloud_translation_v3::model::glossary::LanguageCodePair;
8524    /// let x = Glossary::new().set_languages(Some(
8525    ///     google_cloud_translation_v3::model::glossary::Languages::LanguagePair(LanguageCodePair::default().into())));
8526    /// ```
8527    pub fn set_languages<
8528        T: std::convert::Into<std::option::Option<crate::model::glossary::Languages>>,
8529    >(
8530        mut self,
8531        v: T,
8532    ) -> Self {
8533        self.languages = v.into();
8534        self
8535    }
8536
8537    /// The value of [languages][crate::model::Glossary::languages]
8538    /// if it holds a `LanguagePair`, `None` if the field is not set or
8539    /// holds a different branch.
8540    pub fn language_pair(
8541        &self,
8542    ) -> std::option::Option<&std::boxed::Box<crate::model::glossary::LanguageCodePair>> {
8543        #[allow(unreachable_patterns)]
8544        self.languages.as_ref().and_then(|v| match v {
8545            crate::model::glossary::Languages::LanguagePair(v) => std::option::Option::Some(v),
8546            _ => std::option::Option::None,
8547        })
8548    }
8549
8550    /// Sets the value of [languages][crate::model::Glossary::languages]
8551    /// to hold a `LanguagePair`.
8552    ///
8553    /// Note that all the setters affecting `languages` are
8554    /// mutually exclusive.
8555    ///
8556    /// # Example
8557    /// ```ignore,no_run
8558    /// # use google_cloud_translation_v3::model::Glossary;
8559    /// use google_cloud_translation_v3::model::glossary::LanguageCodePair;
8560    /// let x = Glossary::new().set_language_pair(LanguageCodePair::default()/* use setters */);
8561    /// assert!(x.language_pair().is_some());
8562    /// assert!(x.language_codes_set().is_none());
8563    /// ```
8564    pub fn set_language_pair<
8565        T: std::convert::Into<std::boxed::Box<crate::model::glossary::LanguageCodePair>>,
8566    >(
8567        mut self,
8568        v: T,
8569    ) -> Self {
8570        self.languages =
8571            std::option::Option::Some(crate::model::glossary::Languages::LanguagePair(v.into()));
8572        self
8573    }
8574
8575    /// The value of [languages][crate::model::Glossary::languages]
8576    /// if it holds a `LanguageCodesSet`, `None` if the field is not set or
8577    /// holds a different branch.
8578    pub fn language_codes_set(
8579        &self,
8580    ) -> std::option::Option<&std::boxed::Box<crate::model::glossary::LanguageCodesSet>> {
8581        #[allow(unreachable_patterns)]
8582        self.languages.as_ref().and_then(|v| match v {
8583            crate::model::glossary::Languages::LanguageCodesSet(v) => std::option::Option::Some(v),
8584            _ => std::option::Option::None,
8585        })
8586    }
8587
8588    /// Sets the value of [languages][crate::model::Glossary::languages]
8589    /// to hold a `LanguageCodesSet`.
8590    ///
8591    /// Note that all the setters affecting `languages` are
8592    /// mutually exclusive.
8593    ///
8594    /// # Example
8595    /// ```ignore,no_run
8596    /// # use google_cloud_translation_v3::model::Glossary;
8597    /// use google_cloud_translation_v3::model::glossary::LanguageCodesSet;
8598    /// let x = Glossary::new().set_language_codes_set(LanguageCodesSet::default()/* use setters */);
8599    /// assert!(x.language_codes_set().is_some());
8600    /// assert!(x.language_pair().is_none());
8601    /// ```
8602    pub fn set_language_codes_set<
8603        T: std::convert::Into<std::boxed::Box<crate::model::glossary::LanguageCodesSet>>,
8604    >(
8605        mut self,
8606        v: T,
8607    ) -> Self {
8608        self.languages = std::option::Option::Some(
8609            crate::model::glossary::Languages::LanguageCodesSet(v.into()),
8610        );
8611        self
8612    }
8613}
8614
8615impl wkt::message::Message for Glossary {
8616    fn typename() -> &'static str {
8617        "type.googleapis.com/google.cloud.translation.v3.Glossary"
8618    }
8619}
8620
8621/// Defines additional types related to [Glossary].
8622pub mod glossary {
8623    #[allow(unused_imports)]
8624    use super::*;
8625
8626    /// Used with unidirectional glossaries.
8627    #[derive(Clone, Default, PartialEq)]
8628    #[non_exhaustive]
8629    pub struct LanguageCodePair {
8630        /// Required. The ISO-639 language code of the input text, for example,
8631        /// "en-US". Expected to be an exact match for GlossaryTerm.language_code.
8632        pub source_language_code: std::string::String,
8633
8634        /// Required. The ISO-639 language code for translation output, for example,
8635        /// "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
8636        pub target_language_code: std::string::String,
8637
8638        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8639    }
8640
8641    impl LanguageCodePair {
8642        pub fn new() -> Self {
8643            std::default::Default::default()
8644        }
8645
8646        /// Sets the value of [source_language_code][crate::model::glossary::LanguageCodePair::source_language_code].
8647        ///
8648        /// # Example
8649        /// ```ignore,no_run
8650        /// # use google_cloud_translation_v3::model::glossary::LanguageCodePair;
8651        /// let x = LanguageCodePair::new().set_source_language_code("example");
8652        /// ```
8653        pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
8654            mut self,
8655            v: T,
8656        ) -> Self {
8657            self.source_language_code = v.into();
8658            self
8659        }
8660
8661        /// Sets the value of [target_language_code][crate::model::glossary::LanguageCodePair::target_language_code].
8662        ///
8663        /// # Example
8664        /// ```ignore,no_run
8665        /// # use google_cloud_translation_v3::model::glossary::LanguageCodePair;
8666        /// let x = LanguageCodePair::new().set_target_language_code("example");
8667        /// ```
8668        pub fn set_target_language_code<T: std::convert::Into<std::string::String>>(
8669            mut self,
8670            v: T,
8671        ) -> Self {
8672            self.target_language_code = v.into();
8673            self
8674        }
8675    }
8676
8677    impl wkt::message::Message for LanguageCodePair {
8678        fn typename() -> &'static str {
8679            "type.googleapis.com/google.cloud.translation.v3.Glossary.LanguageCodePair"
8680        }
8681    }
8682
8683    /// Used with equivalent term set glossaries.
8684    #[derive(Clone, Default, PartialEq)]
8685    #[non_exhaustive]
8686    pub struct LanguageCodesSet {
8687        /// The ISO-639 language code(s) for terms defined in the glossary.
8688        /// All entries are unique. The list contains at least two entries.
8689        /// Expected to be an exact match for GlossaryTerm.language_code.
8690        pub language_codes: std::vec::Vec<std::string::String>,
8691
8692        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8693    }
8694
8695    impl LanguageCodesSet {
8696        pub fn new() -> Self {
8697            std::default::Default::default()
8698        }
8699
8700        /// Sets the value of [language_codes][crate::model::glossary::LanguageCodesSet::language_codes].
8701        ///
8702        /// # Example
8703        /// ```ignore,no_run
8704        /// # use google_cloud_translation_v3::model::glossary::LanguageCodesSet;
8705        /// let x = LanguageCodesSet::new().set_language_codes(["a", "b", "c"]);
8706        /// ```
8707        pub fn set_language_codes<T, V>(mut self, v: T) -> Self
8708        where
8709            T: std::iter::IntoIterator<Item = V>,
8710            V: std::convert::Into<std::string::String>,
8711        {
8712            use std::iter::Iterator;
8713            self.language_codes = v.into_iter().map(|i| i.into()).collect();
8714            self
8715        }
8716    }
8717
8718    impl wkt::message::Message for LanguageCodesSet {
8719        fn typename() -> &'static str {
8720            "type.googleapis.com/google.cloud.translation.v3.Glossary.LanguageCodesSet"
8721        }
8722    }
8723
8724    /// Languages supported by the glossary.
8725    #[derive(Clone, Debug, PartialEq)]
8726    #[non_exhaustive]
8727    pub enum Languages {
8728        /// Used with unidirectional glossaries.
8729        LanguagePair(std::boxed::Box<crate::model::glossary::LanguageCodePair>),
8730        /// Used with equivalent term set glossaries.
8731        LanguageCodesSet(std::boxed::Box<crate::model::glossary::LanguageCodesSet>),
8732    }
8733}
8734
8735/// Request message for CreateGlossary.
8736#[derive(Clone, Default, PartialEq)]
8737#[non_exhaustive]
8738pub struct CreateGlossaryRequest {
8739    /// Required. The project name.
8740    pub parent: std::string::String,
8741
8742    /// Required. The glossary to create.
8743    pub glossary: std::option::Option<crate::model::Glossary>,
8744
8745    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8746}
8747
8748impl CreateGlossaryRequest {
8749    pub fn new() -> Self {
8750        std::default::Default::default()
8751    }
8752
8753    /// Sets the value of [parent][crate::model::CreateGlossaryRequest::parent].
8754    ///
8755    /// # Example
8756    /// ```ignore,no_run
8757    /// # use google_cloud_translation_v3::model::CreateGlossaryRequest;
8758    /// let x = CreateGlossaryRequest::new().set_parent("example");
8759    /// ```
8760    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8761        self.parent = v.into();
8762        self
8763    }
8764
8765    /// Sets the value of [glossary][crate::model::CreateGlossaryRequest::glossary].
8766    ///
8767    /// # Example
8768    /// ```ignore,no_run
8769    /// # use google_cloud_translation_v3::model::CreateGlossaryRequest;
8770    /// use google_cloud_translation_v3::model::Glossary;
8771    /// let x = CreateGlossaryRequest::new().set_glossary(Glossary::default()/* use setters */);
8772    /// ```
8773    pub fn set_glossary<T>(mut self, v: T) -> Self
8774    where
8775        T: std::convert::Into<crate::model::Glossary>,
8776    {
8777        self.glossary = std::option::Option::Some(v.into());
8778        self
8779    }
8780
8781    /// Sets or clears the value of [glossary][crate::model::CreateGlossaryRequest::glossary].
8782    ///
8783    /// # Example
8784    /// ```ignore,no_run
8785    /// # use google_cloud_translation_v3::model::CreateGlossaryRequest;
8786    /// use google_cloud_translation_v3::model::Glossary;
8787    /// let x = CreateGlossaryRequest::new().set_or_clear_glossary(Some(Glossary::default()/* use setters */));
8788    /// let x = CreateGlossaryRequest::new().set_or_clear_glossary(None::<Glossary>);
8789    /// ```
8790    pub fn set_or_clear_glossary<T>(mut self, v: std::option::Option<T>) -> Self
8791    where
8792        T: std::convert::Into<crate::model::Glossary>,
8793    {
8794        self.glossary = v.map(|x| x.into());
8795        self
8796    }
8797}
8798
8799impl wkt::message::Message for CreateGlossaryRequest {
8800    fn typename() -> &'static str {
8801        "type.googleapis.com/google.cloud.translation.v3.CreateGlossaryRequest"
8802    }
8803}
8804
8805/// Request message for the update glossary flow
8806#[derive(Clone, Default, PartialEq)]
8807#[non_exhaustive]
8808pub struct UpdateGlossaryRequest {
8809    /// Required. The glossary entry to update.
8810    pub glossary: std::option::Option<crate::model::Glossary>,
8811
8812    /// The list of fields to be updated. Currently only `display_name` and
8813    /// 'input_config'
8814    pub update_mask: std::option::Option<wkt::FieldMask>,
8815
8816    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8817}
8818
8819impl UpdateGlossaryRequest {
8820    pub fn new() -> Self {
8821        std::default::Default::default()
8822    }
8823
8824    /// Sets the value of [glossary][crate::model::UpdateGlossaryRequest::glossary].
8825    ///
8826    /// # Example
8827    /// ```ignore,no_run
8828    /// # use google_cloud_translation_v3::model::UpdateGlossaryRequest;
8829    /// use google_cloud_translation_v3::model::Glossary;
8830    /// let x = UpdateGlossaryRequest::new().set_glossary(Glossary::default()/* use setters */);
8831    /// ```
8832    pub fn set_glossary<T>(mut self, v: T) -> Self
8833    where
8834        T: std::convert::Into<crate::model::Glossary>,
8835    {
8836        self.glossary = std::option::Option::Some(v.into());
8837        self
8838    }
8839
8840    /// Sets or clears the value of [glossary][crate::model::UpdateGlossaryRequest::glossary].
8841    ///
8842    /// # Example
8843    /// ```ignore,no_run
8844    /// # use google_cloud_translation_v3::model::UpdateGlossaryRequest;
8845    /// use google_cloud_translation_v3::model::Glossary;
8846    /// let x = UpdateGlossaryRequest::new().set_or_clear_glossary(Some(Glossary::default()/* use setters */));
8847    /// let x = UpdateGlossaryRequest::new().set_or_clear_glossary(None::<Glossary>);
8848    /// ```
8849    pub fn set_or_clear_glossary<T>(mut self, v: std::option::Option<T>) -> Self
8850    where
8851        T: std::convert::Into<crate::model::Glossary>,
8852    {
8853        self.glossary = v.map(|x| x.into());
8854        self
8855    }
8856
8857    /// Sets the value of [update_mask][crate::model::UpdateGlossaryRequest::update_mask].
8858    ///
8859    /// # Example
8860    /// ```ignore,no_run
8861    /// # use google_cloud_translation_v3::model::UpdateGlossaryRequest;
8862    /// use wkt::FieldMask;
8863    /// let x = UpdateGlossaryRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8864    /// ```
8865    pub fn set_update_mask<T>(mut self, v: T) -> Self
8866    where
8867        T: std::convert::Into<wkt::FieldMask>,
8868    {
8869        self.update_mask = std::option::Option::Some(v.into());
8870        self
8871    }
8872
8873    /// Sets or clears the value of [update_mask][crate::model::UpdateGlossaryRequest::update_mask].
8874    ///
8875    /// # Example
8876    /// ```ignore,no_run
8877    /// # use google_cloud_translation_v3::model::UpdateGlossaryRequest;
8878    /// use wkt::FieldMask;
8879    /// let x = UpdateGlossaryRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8880    /// let x = UpdateGlossaryRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8881    /// ```
8882    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8883    where
8884        T: std::convert::Into<wkt::FieldMask>,
8885    {
8886        self.update_mask = v.map(|x| x.into());
8887        self
8888    }
8889}
8890
8891impl wkt::message::Message for UpdateGlossaryRequest {
8892    fn typename() -> &'static str {
8893        "type.googleapis.com/google.cloud.translation.v3.UpdateGlossaryRequest"
8894    }
8895}
8896
8897/// Request message for GetGlossary.
8898#[derive(Clone, Default, PartialEq)]
8899#[non_exhaustive]
8900pub struct GetGlossaryRequest {
8901    /// Required. The name of the glossary to retrieve.
8902    pub name: std::string::String,
8903
8904    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8905}
8906
8907impl GetGlossaryRequest {
8908    pub fn new() -> Self {
8909        std::default::Default::default()
8910    }
8911
8912    /// Sets the value of [name][crate::model::GetGlossaryRequest::name].
8913    ///
8914    /// # Example
8915    /// ```ignore,no_run
8916    /// # use google_cloud_translation_v3::model::GetGlossaryRequest;
8917    /// let x = GetGlossaryRequest::new().set_name("example");
8918    /// ```
8919    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8920        self.name = v.into();
8921        self
8922    }
8923}
8924
8925impl wkt::message::Message for GetGlossaryRequest {
8926    fn typename() -> &'static str {
8927        "type.googleapis.com/google.cloud.translation.v3.GetGlossaryRequest"
8928    }
8929}
8930
8931/// Request message for DeleteGlossary.
8932#[derive(Clone, Default, PartialEq)]
8933#[non_exhaustive]
8934pub struct DeleteGlossaryRequest {
8935    /// Required. The name of the glossary to delete.
8936    pub name: std::string::String,
8937
8938    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8939}
8940
8941impl DeleteGlossaryRequest {
8942    pub fn new() -> Self {
8943        std::default::Default::default()
8944    }
8945
8946    /// Sets the value of [name][crate::model::DeleteGlossaryRequest::name].
8947    ///
8948    /// # Example
8949    /// ```ignore,no_run
8950    /// # use google_cloud_translation_v3::model::DeleteGlossaryRequest;
8951    /// let x = DeleteGlossaryRequest::new().set_name("example");
8952    /// ```
8953    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8954        self.name = v.into();
8955        self
8956    }
8957}
8958
8959impl wkt::message::Message for DeleteGlossaryRequest {
8960    fn typename() -> &'static str {
8961        "type.googleapis.com/google.cloud.translation.v3.DeleteGlossaryRequest"
8962    }
8963}
8964
8965/// Request message for ListGlossaries.
8966#[derive(Clone, Default, PartialEq)]
8967#[non_exhaustive]
8968pub struct ListGlossariesRequest {
8969    /// Required. The name of the project from which to list all of the glossaries.
8970    pub parent: std::string::String,
8971
8972    /// Optional. Requested page size. The server may return fewer glossaries than
8973    /// requested. If unspecified, the server picks an appropriate default.
8974    pub page_size: i32,
8975
8976    /// Optional. A token identifying a page of results the server should return.
8977    /// Typically, this is the value of [ListGlossariesResponse.next_page_token]
8978    /// returned from the previous call to `ListGlossaries` method.
8979    /// The first page is returned if `page_token`is empty or missing.
8980    pub page_token: std::string::String,
8981
8982    /// Optional. Filter specifying constraints of a list operation.
8983    /// Specify the constraint by the format of "key=value", where key must be
8984    /// "src" or "tgt", and the value must be a valid language code.
8985    /// For multiple restrictions, concatenate them by "AND" (uppercase only),
8986    /// such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used
8987    /// here, which means using 'en-US' and 'en' can lead to different results,
8988    /// which depends on the language code you used when you create the glossary.
8989    /// For the unidirectional glossaries, the "src" and "tgt" add restrictions
8990    /// on the source and target language code separately.
8991    /// For the equivalent term set glossaries, the "src" and/or "tgt" add
8992    /// restrictions on the term set.
8993    /// For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional
8994    /// glossaries which exactly match the source language code as "en-US" and the
8995    /// target language code "zh-CN", but all equivalent term set glossaries which
8996    /// contain "en-US" and "zh-CN" in their language set will be picked.
8997    /// If missing, no filtering is performed.
8998    pub filter: std::string::String,
8999
9000    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9001}
9002
9003impl ListGlossariesRequest {
9004    pub fn new() -> Self {
9005        std::default::Default::default()
9006    }
9007
9008    /// Sets the value of [parent][crate::model::ListGlossariesRequest::parent].
9009    ///
9010    /// # Example
9011    /// ```ignore,no_run
9012    /// # use google_cloud_translation_v3::model::ListGlossariesRequest;
9013    /// let x = ListGlossariesRequest::new().set_parent("example");
9014    /// ```
9015    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9016        self.parent = v.into();
9017        self
9018    }
9019
9020    /// Sets the value of [page_size][crate::model::ListGlossariesRequest::page_size].
9021    ///
9022    /// # Example
9023    /// ```ignore,no_run
9024    /// # use google_cloud_translation_v3::model::ListGlossariesRequest;
9025    /// let x = ListGlossariesRequest::new().set_page_size(42);
9026    /// ```
9027    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9028        self.page_size = v.into();
9029        self
9030    }
9031
9032    /// Sets the value of [page_token][crate::model::ListGlossariesRequest::page_token].
9033    ///
9034    /// # Example
9035    /// ```ignore,no_run
9036    /// # use google_cloud_translation_v3::model::ListGlossariesRequest;
9037    /// let x = ListGlossariesRequest::new().set_page_token("example");
9038    /// ```
9039    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9040        self.page_token = v.into();
9041        self
9042    }
9043
9044    /// Sets the value of [filter][crate::model::ListGlossariesRequest::filter].
9045    ///
9046    /// # Example
9047    /// ```ignore,no_run
9048    /// # use google_cloud_translation_v3::model::ListGlossariesRequest;
9049    /// let x = ListGlossariesRequest::new().set_filter("example");
9050    /// ```
9051    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9052        self.filter = v.into();
9053        self
9054    }
9055}
9056
9057impl wkt::message::Message for ListGlossariesRequest {
9058    fn typename() -> &'static str {
9059        "type.googleapis.com/google.cloud.translation.v3.ListGlossariesRequest"
9060    }
9061}
9062
9063/// Response message for ListGlossaries.
9064#[derive(Clone, Default, PartialEq)]
9065#[non_exhaustive]
9066pub struct ListGlossariesResponse {
9067    /// The list of glossaries for a project.
9068    pub glossaries: std::vec::Vec<crate::model::Glossary>,
9069
9070    /// A token to retrieve a page of results. Pass this value in the
9071    /// [ListGlossariesRequest.page_token] field in the subsequent call to
9072    /// `ListGlossaries` method to retrieve the next page of results.
9073    pub next_page_token: std::string::String,
9074
9075    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9076}
9077
9078impl ListGlossariesResponse {
9079    pub fn new() -> Self {
9080        std::default::Default::default()
9081    }
9082
9083    /// Sets the value of [glossaries][crate::model::ListGlossariesResponse::glossaries].
9084    ///
9085    /// # Example
9086    /// ```ignore,no_run
9087    /// # use google_cloud_translation_v3::model::ListGlossariesResponse;
9088    /// use google_cloud_translation_v3::model::Glossary;
9089    /// let x = ListGlossariesResponse::new()
9090    ///     .set_glossaries([
9091    ///         Glossary::default()/* use setters */,
9092    ///         Glossary::default()/* use (different) setters */,
9093    ///     ]);
9094    /// ```
9095    pub fn set_glossaries<T, V>(mut self, v: T) -> Self
9096    where
9097        T: std::iter::IntoIterator<Item = V>,
9098        V: std::convert::Into<crate::model::Glossary>,
9099    {
9100        use std::iter::Iterator;
9101        self.glossaries = v.into_iter().map(|i| i.into()).collect();
9102        self
9103    }
9104
9105    /// Sets the value of [next_page_token][crate::model::ListGlossariesResponse::next_page_token].
9106    ///
9107    /// # Example
9108    /// ```ignore,no_run
9109    /// # use google_cloud_translation_v3::model::ListGlossariesResponse;
9110    /// let x = ListGlossariesResponse::new().set_next_page_token("example");
9111    /// ```
9112    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9113        self.next_page_token = v.into();
9114        self
9115    }
9116}
9117
9118impl wkt::message::Message for ListGlossariesResponse {
9119    fn typename() -> &'static str {
9120        "type.googleapis.com/google.cloud.translation.v3.ListGlossariesResponse"
9121    }
9122}
9123
9124#[doc(hidden)]
9125impl google_cloud_gax::paginator::internal::PageableResponse for ListGlossariesResponse {
9126    type PageItem = crate::model::Glossary;
9127
9128    fn items(self) -> std::vec::Vec<Self::PageItem> {
9129        self.glossaries
9130    }
9131
9132    fn next_page_token(&self) -> std::string::String {
9133        use std::clone::Clone;
9134        self.next_page_token.clone()
9135    }
9136}
9137
9138/// Request message for the Get Glossary Entry Api
9139#[derive(Clone, Default, PartialEq)]
9140#[non_exhaustive]
9141pub struct GetGlossaryEntryRequest {
9142    /// Required. The resource name of the glossary entry to get
9143    pub name: std::string::String,
9144
9145    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9146}
9147
9148impl GetGlossaryEntryRequest {
9149    pub fn new() -> Self {
9150        std::default::Default::default()
9151    }
9152
9153    /// Sets the value of [name][crate::model::GetGlossaryEntryRequest::name].
9154    ///
9155    /// # Example
9156    /// ```ignore,no_run
9157    /// # use google_cloud_translation_v3::model::GetGlossaryEntryRequest;
9158    /// let x = GetGlossaryEntryRequest::new().set_name("example");
9159    /// ```
9160    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9161        self.name = v.into();
9162        self
9163    }
9164}
9165
9166impl wkt::message::Message for GetGlossaryEntryRequest {
9167    fn typename() -> &'static str {
9168        "type.googleapis.com/google.cloud.translation.v3.GetGlossaryEntryRequest"
9169    }
9170}
9171
9172/// Request message for Delete Glossary Entry
9173#[derive(Clone, Default, PartialEq)]
9174#[non_exhaustive]
9175pub struct DeleteGlossaryEntryRequest {
9176    /// Required. The resource name of the glossary entry to delete
9177    pub name: std::string::String,
9178
9179    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9180}
9181
9182impl DeleteGlossaryEntryRequest {
9183    pub fn new() -> Self {
9184        std::default::Default::default()
9185    }
9186
9187    /// Sets the value of [name][crate::model::DeleteGlossaryEntryRequest::name].
9188    ///
9189    /// # Example
9190    /// ```ignore,no_run
9191    /// # use google_cloud_translation_v3::model::DeleteGlossaryEntryRequest;
9192    /// let x = DeleteGlossaryEntryRequest::new().set_name("example");
9193    /// ```
9194    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9195        self.name = v.into();
9196        self
9197    }
9198}
9199
9200impl wkt::message::Message for DeleteGlossaryEntryRequest {
9201    fn typename() -> &'static str {
9202        "type.googleapis.com/google.cloud.translation.v3.DeleteGlossaryEntryRequest"
9203    }
9204}
9205
9206/// Request message for ListGlossaryEntries
9207#[derive(Clone, Default, PartialEq)]
9208#[non_exhaustive]
9209pub struct ListGlossaryEntriesRequest {
9210    /// Required. The parent glossary resource name for listing the glossary's
9211    /// entries.
9212    pub parent: std::string::String,
9213
9214    /// Optional. Requested page size. The server may return fewer glossary entries
9215    /// than requested. If unspecified, the server picks an appropriate default.
9216    pub page_size: i32,
9217
9218    /// Optional. A token identifying a page of results the server should return.
9219    /// Typically, this is the value of
9220    /// [ListGlossaryEntriesResponse.next_page_token] returned from the previous
9221    /// call. The first page is returned if `page_token`is empty or missing.
9222    pub page_token: std::string::String,
9223
9224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9225}
9226
9227impl ListGlossaryEntriesRequest {
9228    pub fn new() -> Self {
9229        std::default::Default::default()
9230    }
9231
9232    /// Sets the value of [parent][crate::model::ListGlossaryEntriesRequest::parent].
9233    ///
9234    /// # Example
9235    /// ```ignore,no_run
9236    /// # use google_cloud_translation_v3::model::ListGlossaryEntriesRequest;
9237    /// let x = ListGlossaryEntriesRequest::new().set_parent("example");
9238    /// ```
9239    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9240        self.parent = v.into();
9241        self
9242    }
9243
9244    /// Sets the value of [page_size][crate::model::ListGlossaryEntriesRequest::page_size].
9245    ///
9246    /// # Example
9247    /// ```ignore,no_run
9248    /// # use google_cloud_translation_v3::model::ListGlossaryEntriesRequest;
9249    /// let x = ListGlossaryEntriesRequest::new().set_page_size(42);
9250    /// ```
9251    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9252        self.page_size = v.into();
9253        self
9254    }
9255
9256    /// Sets the value of [page_token][crate::model::ListGlossaryEntriesRequest::page_token].
9257    ///
9258    /// # Example
9259    /// ```ignore,no_run
9260    /// # use google_cloud_translation_v3::model::ListGlossaryEntriesRequest;
9261    /// let x = ListGlossaryEntriesRequest::new().set_page_token("example");
9262    /// ```
9263    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9264        self.page_token = v.into();
9265        self
9266    }
9267}
9268
9269impl wkt::message::Message for ListGlossaryEntriesRequest {
9270    fn typename() -> &'static str {
9271        "type.googleapis.com/google.cloud.translation.v3.ListGlossaryEntriesRequest"
9272    }
9273}
9274
9275/// Response message for ListGlossaryEntries
9276#[derive(Clone, Default, PartialEq)]
9277#[non_exhaustive]
9278pub struct ListGlossaryEntriesResponse {
9279    /// Optional. The Glossary Entries
9280    pub glossary_entries: std::vec::Vec<crate::model::GlossaryEntry>,
9281
9282    /// Optional. A token to retrieve a page of results. Pass this value in the
9283    /// [ListGLossaryEntriesRequest.page_token] field in the subsequent calls.
9284    pub next_page_token: std::string::String,
9285
9286    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9287}
9288
9289impl ListGlossaryEntriesResponse {
9290    pub fn new() -> Self {
9291        std::default::Default::default()
9292    }
9293
9294    /// Sets the value of [glossary_entries][crate::model::ListGlossaryEntriesResponse::glossary_entries].
9295    ///
9296    /// # Example
9297    /// ```ignore,no_run
9298    /// # use google_cloud_translation_v3::model::ListGlossaryEntriesResponse;
9299    /// use google_cloud_translation_v3::model::GlossaryEntry;
9300    /// let x = ListGlossaryEntriesResponse::new()
9301    ///     .set_glossary_entries([
9302    ///         GlossaryEntry::default()/* use setters */,
9303    ///         GlossaryEntry::default()/* use (different) setters */,
9304    ///     ]);
9305    /// ```
9306    pub fn set_glossary_entries<T, V>(mut self, v: T) -> Self
9307    where
9308        T: std::iter::IntoIterator<Item = V>,
9309        V: std::convert::Into<crate::model::GlossaryEntry>,
9310    {
9311        use std::iter::Iterator;
9312        self.glossary_entries = v.into_iter().map(|i| i.into()).collect();
9313        self
9314    }
9315
9316    /// Sets the value of [next_page_token][crate::model::ListGlossaryEntriesResponse::next_page_token].
9317    ///
9318    /// # Example
9319    /// ```ignore,no_run
9320    /// # use google_cloud_translation_v3::model::ListGlossaryEntriesResponse;
9321    /// let x = ListGlossaryEntriesResponse::new().set_next_page_token("example");
9322    /// ```
9323    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9324        self.next_page_token = v.into();
9325        self
9326    }
9327}
9328
9329impl wkt::message::Message for ListGlossaryEntriesResponse {
9330    fn typename() -> &'static str {
9331        "type.googleapis.com/google.cloud.translation.v3.ListGlossaryEntriesResponse"
9332    }
9333}
9334
9335#[doc(hidden)]
9336impl google_cloud_gax::paginator::internal::PageableResponse for ListGlossaryEntriesResponse {
9337    type PageItem = crate::model::GlossaryEntry;
9338
9339    fn items(self) -> std::vec::Vec<Self::PageItem> {
9340        self.glossary_entries
9341    }
9342
9343    fn next_page_token(&self) -> std::string::String {
9344        use std::clone::Clone;
9345        self.next_page_token.clone()
9346    }
9347}
9348
9349/// Request message for CreateGlossaryEntry
9350#[derive(Clone, Default, PartialEq)]
9351#[non_exhaustive]
9352pub struct CreateGlossaryEntryRequest {
9353    /// Required. The resource name of the glossary to create the entry under.
9354    pub parent: std::string::String,
9355
9356    /// Required. The glossary entry to create
9357    pub glossary_entry: std::option::Option<crate::model::GlossaryEntry>,
9358
9359    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9360}
9361
9362impl CreateGlossaryEntryRequest {
9363    pub fn new() -> Self {
9364        std::default::Default::default()
9365    }
9366
9367    /// Sets the value of [parent][crate::model::CreateGlossaryEntryRequest::parent].
9368    ///
9369    /// # Example
9370    /// ```ignore,no_run
9371    /// # use google_cloud_translation_v3::model::CreateGlossaryEntryRequest;
9372    /// let x = CreateGlossaryEntryRequest::new().set_parent("example");
9373    /// ```
9374    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9375        self.parent = v.into();
9376        self
9377    }
9378
9379    /// Sets the value of [glossary_entry][crate::model::CreateGlossaryEntryRequest::glossary_entry].
9380    ///
9381    /// # Example
9382    /// ```ignore,no_run
9383    /// # use google_cloud_translation_v3::model::CreateGlossaryEntryRequest;
9384    /// use google_cloud_translation_v3::model::GlossaryEntry;
9385    /// let x = CreateGlossaryEntryRequest::new().set_glossary_entry(GlossaryEntry::default()/* use setters */);
9386    /// ```
9387    pub fn set_glossary_entry<T>(mut self, v: T) -> Self
9388    where
9389        T: std::convert::Into<crate::model::GlossaryEntry>,
9390    {
9391        self.glossary_entry = std::option::Option::Some(v.into());
9392        self
9393    }
9394
9395    /// Sets or clears the value of [glossary_entry][crate::model::CreateGlossaryEntryRequest::glossary_entry].
9396    ///
9397    /// # Example
9398    /// ```ignore,no_run
9399    /// # use google_cloud_translation_v3::model::CreateGlossaryEntryRequest;
9400    /// use google_cloud_translation_v3::model::GlossaryEntry;
9401    /// let x = CreateGlossaryEntryRequest::new().set_or_clear_glossary_entry(Some(GlossaryEntry::default()/* use setters */));
9402    /// let x = CreateGlossaryEntryRequest::new().set_or_clear_glossary_entry(None::<GlossaryEntry>);
9403    /// ```
9404    pub fn set_or_clear_glossary_entry<T>(mut self, v: std::option::Option<T>) -> Self
9405    where
9406        T: std::convert::Into<crate::model::GlossaryEntry>,
9407    {
9408        self.glossary_entry = v.map(|x| x.into());
9409        self
9410    }
9411}
9412
9413impl wkt::message::Message for CreateGlossaryEntryRequest {
9414    fn typename() -> &'static str {
9415        "type.googleapis.com/google.cloud.translation.v3.CreateGlossaryEntryRequest"
9416    }
9417}
9418
9419/// Request message for UpdateGlossaryEntry
9420#[derive(Clone, Default, PartialEq)]
9421#[non_exhaustive]
9422pub struct UpdateGlossaryEntryRequest {
9423    /// Required. The glossary entry to update.
9424    pub glossary_entry: std::option::Option<crate::model::GlossaryEntry>,
9425
9426    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9427}
9428
9429impl UpdateGlossaryEntryRequest {
9430    pub fn new() -> Self {
9431        std::default::Default::default()
9432    }
9433
9434    /// Sets the value of [glossary_entry][crate::model::UpdateGlossaryEntryRequest::glossary_entry].
9435    ///
9436    /// # Example
9437    /// ```ignore,no_run
9438    /// # use google_cloud_translation_v3::model::UpdateGlossaryEntryRequest;
9439    /// use google_cloud_translation_v3::model::GlossaryEntry;
9440    /// let x = UpdateGlossaryEntryRequest::new().set_glossary_entry(GlossaryEntry::default()/* use setters */);
9441    /// ```
9442    pub fn set_glossary_entry<T>(mut self, v: T) -> Self
9443    where
9444        T: std::convert::Into<crate::model::GlossaryEntry>,
9445    {
9446        self.glossary_entry = std::option::Option::Some(v.into());
9447        self
9448    }
9449
9450    /// Sets or clears the value of [glossary_entry][crate::model::UpdateGlossaryEntryRequest::glossary_entry].
9451    ///
9452    /// # Example
9453    /// ```ignore,no_run
9454    /// # use google_cloud_translation_v3::model::UpdateGlossaryEntryRequest;
9455    /// use google_cloud_translation_v3::model::GlossaryEntry;
9456    /// let x = UpdateGlossaryEntryRequest::new().set_or_clear_glossary_entry(Some(GlossaryEntry::default()/* use setters */));
9457    /// let x = UpdateGlossaryEntryRequest::new().set_or_clear_glossary_entry(None::<GlossaryEntry>);
9458    /// ```
9459    pub fn set_or_clear_glossary_entry<T>(mut self, v: std::option::Option<T>) -> Self
9460    where
9461        T: std::convert::Into<crate::model::GlossaryEntry>,
9462    {
9463        self.glossary_entry = v.map(|x| x.into());
9464        self
9465    }
9466}
9467
9468impl wkt::message::Message for UpdateGlossaryEntryRequest {
9469    fn typename() -> &'static str {
9470        "type.googleapis.com/google.cloud.translation.v3.UpdateGlossaryEntryRequest"
9471    }
9472}
9473
9474/// Stored in the
9475/// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
9476/// field returned by CreateGlossary.
9477///
9478/// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
9479#[derive(Clone, Default, PartialEq)]
9480#[non_exhaustive]
9481pub struct CreateGlossaryMetadata {
9482    /// The name of the glossary that is being created.
9483    pub name: std::string::String,
9484
9485    /// The current state of the glossary creation operation.
9486    pub state: crate::model::create_glossary_metadata::State,
9487
9488    /// The time when the operation was submitted to the server.
9489    pub submit_time: std::option::Option<wkt::Timestamp>,
9490
9491    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9492}
9493
9494impl CreateGlossaryMetadata {
9495    pub fn new() -> Self {
9496        std::default::Default::default()
9497    }
9498
9499    /// Sets the value of [name][crate::model::CreateGlossaryMetadata::name].
9500    ///
9501    /// # Example
9502    /// ```ignore,no_run
9503    /// # use google_cloud_translation_v3::model::CreateGlossaryMetadata;
9504    /// let x = CreateGlossaryMetadata::new().set_name("example");
9505    /// ```
9506    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9507        self.name = v.into();
9508        self
9509    }
9510
9511    /// Sets the value of [state][crate::model::CreateGlossaryMetadata::state].
9512    ///
9513    /// # Example
9514    /// ```ignore,no_run
9515    /// # use google_cloud_translation_v3::model::CreateGlossaryMetadata;
9516    /// use google_cloud_translation_v3::model::create_glossary_metadata::State;
9517    /// let x0 = CreateGlossaryMetadata::new().set_state(State::Running);
9518    /// let x1 = CreateGlossaryMetadata::new().set_state(State::Succeeded);
9519    /// let x2 = CreateGlossaryMetadata::new().set_state(State::Failed);
9520    /// ```
9521    pub fn set_state<T: std::convert::Into<crate::model::create_glossary_metadata::State>>(
9522        mut self,
9523        v: T,
9524    ) -> Self {
9525        self.state = v.into();
9526        self
9527    }
9528
9529    /// Sets the value of [submit_time][crate::model::CreateGlossaryMetadata::submit_time].
9530    ///
9531    /// # Example
9532    /// ```ignore,no_run
9533    /// # use google_cloud_translation_v3::model::CreateGlossaryMetadata;
9534    /// use wkt::Timestamp;
9535    /// let x = CreateGlossaryMetadata::new().set_submit_time(Timestamp::default()/* use setters */);
9536    /// ```
9537    pub fn set_submit_time<T>(mut self, v: T) -> Self
9538    where
9539        T: std::convert::Into<wkt::Timestamp>,
9540    {
9541        self.submit_time = std::option::Option::Some(v.into());
9542        self
9543    }
9544
9545    /// Sets or clears the value of [submit_time][crate::model::CreateGlossaryMetadata::submit_time].
9546    ///
9547    /// # Example
9548    /// ```ignore,no_run
9549    /// # use google_cloud_translation_v3::model::CreateGlossaryMetadata;
9550    /// use wkt::Timestamp;
9551    /// let x = CreateGlossaryMetadata::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
9552    /// let x = CreateGlossaryMetadata::new().set_or_clear_submit_time(None::<Timestamp>);
9553    /// ```
9554    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
9555    where
9556        T: std::convert::Into<wkt::Timestamp>,
9557    {
9558        self.submit_time = v.map(|x| x.into());
9559        self
9560    }
9561}
9562
9563impl wkt::message::Message for CreateGlossaryMetadata {
9564    fn typename() -> &'static str {
9565        "type.googleapis.com/google.cloud.translation.v3.CreateGlossaryMetadata"
9566    }
9567}
9568
9569/// Defines additional types related to [CreateGlossaryMetadata].
9570pub mod create_glossary_metadata {
9571    #[allow(unused_imports)]
9572    use super::*;
9573
9574    /// Enumerates the possible states that the creation request can be in.
9575    ///
9576    /// # Working with unknown values
9577    ///
9578    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9579    /// additional enum variants at any time. Adding new variants is not considered
9580    /// a breaking change. Applications should write their code in anticipation of:
9581    ///
9582    /// - New values appearing in future releases of the client library, **and**
9583    /// - New values received dynamically, without application changes.
9584    ///
9585    /// Please consult the [Working with enums] section in the user guide for some
9586    /// guidelines.
9587    ///
9588    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9589    #[derive(Clone, Debug, PartialEq)]
9590    #[non_exhaustive]
9591    pub enum State {
9592        /// Invalid.
9593        Unspecified,
9594        /// Request is being processed.
9595        Running,
9596        /// The glossary was successfully created.
9597        Succeeded,
9598        /// Failed to create the glossary.
9599        Failed,
9600        /// Request is in the process of being canceled after caller invoked
9601        /// longrunning.Operations.CancelOperation on the request id.
9602        Cancelling,
9603        /// The glossary creation request was successfully canceled.
9604        Cancelled,
9605        /// If set, the enum was initialized with an unknown value.
9606        ///
9607        /// Applications can examine the value using [State::value] or
9608        /// [State::name].
9609        UnknownValue(state::UnknownValue),
9610    }
9611
9612    #[doc(hidden)]
9613    pub mod state {
9614        #[allow(unused_imports)]
9615        use super::*;
9616        #[derive(Clone, Debug, PartialEq)]
9617        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9618    }
9619
9620    impl State {
9621        /// Gets the enum value.
9622        ///
9623        /// Returns `None` if the enum contains an unknown value deserialized from
9624        /// the string representation of enums.
9625        pub fn value(&self) -> std::option::Option<i32> {
9626            match self {
9627                Self::Unspecified => std::option::Option::Some(0),
9628                Self::Running => std::option::Option::Some(1),
9629                Self::Succeeded => std::option::Option::Some(2),
9630                Self::Failed => std::option::Option::Some(3),
9631                Self::Cancelling => std::option::Option::Some(4),
9632                Self::Cancelled => std::option::Option::Some(5),
9633                Self::UnknownValue(u) => u.0.value(),
9634            }
9635        }
9636
9637        /// Gets the enum value as a string.
9638        ///
9639        /// Returns `None` if the enum contains an unknown value deserialized from
9640        /// the integer representation of enums.
9641        pub fn name(&self) -> std::option::Option<&str> {
9642            match self {
9643                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9644                Self::Running => std::option::Option::Some("RUNNING"),
9645                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9646                Self::Failed => std::option::Option::Some("FAILED"),
9647                Self::Cancelling => std::option::Option::Some("CANCELLING"),
9648                Self::Cancelled => std::option::Option::Some("CANCELLED"),
9649                Self::UnknownValue(u) => u.0.name(),
9650            }
9651        }
9652    }
9653
9654    impl std::default::Default for State {
9655        fn default() -> Self {
9656            use std::convert::From;
9657            Self::from(0)
9658        }
9659    }
9660
9661    impl std::fmt::Display for State {
9662        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9663            wkt::internal::display_enum(f, self.name(), self.value())
9664        }
9665    }
9666
9667    impl std::convert::From<i32> for State {
9668        fn from(value: i32) -> Self {
9669            match value {
9670                0 => Self::Unspecified,
9671                1 => Self::Running,
9672                2 => Self::Succeeded,
9673                3 => Self::Failed,
9674                4 => Self::Cancelling,
9675                5 => Self::Cancelled,
9676                _ => Self::UnknownValue(state::UnknownValue(
9677                    wkt::internal::UnknownEnumValue::Integer(value),
9678                )),
9679            }
9680        }
9681    }
9682
9683    impl std::convert::From<&str> for State {
9684        fn from(value: &str) -> Self {
9685            use std::string::ToString;
9686            match value {
9687                "STATE_UNSPECIFIED" => Self::Unspecified,
9688                "RUNNING" => Self::Running,
9689                "SUCCEEDED" => Self::Succeeded,
9690                "FAILED" => Self::Failed,
9691                "CANCELLING" => Self::Cancelling,
9692                "CANCELLED" => Self::Cancelled,
9693                _ => Self::UnknownValue(state::UnknownValue(
9694                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9695                )),
9696            }
9697        }
9698    }
9699
9700    impl serde::ser::Serialize for State {
9701        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9702        where
9703            S: serde::Serializer,
9704        {
9705            match self {
9706                Self::Unspecified => serializer.serialize_i32(0),
9707                Self::Running => serializer.serialize_i32(1),
9708                Self::Succeeded => serializer.serialize_i32(2),
9709                Self::Failed => serializer.serialize_i32(3),
9710                Self::Cancelling => serializer.serialize_i32(4),
9711                Self::Cancelled => serializer.serialize_i32(5),
9712                Self::UnknownValue(u) => u.0.serialize(serializer),
9713            }
9714        }
9715    }
9716
9717    impl<'de> serde::de::Deserialize<'de> for State {
9718        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9719        where
9720            D: serde::Deserializer<'de>,
9721        {
9722            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9723                ".google.cloud.translation.v3.CreateGlossaryMetadata.State",
9724            ))
9725        }
9726    }
9727}
9728
9729/// Stored in the
9730/// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
9731/// field returned by UpdateGlossary.
9732///
9733/// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
9734#[derive(Clone, Default, PartialEq)]
9735#[non_exhaustive]
9736pub struct UpdateGlossaryMetadata {
9737    /// The updated glossary object.
9738    pub glossary: std::option::Option<crate::model::Glossary>,
9739
9740    /// The current state of the glossary update operation. If the glossary input
9741    /// file was not updated this will be completed immediately
9742    pub state: crate::model::update_glossary_metadata::State,
9743
9744    /// The time when the operation was submitted to the server.
9745    pub submit_time: std::option::Option<wkt::Timestamp>,
9746
9747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9748}
9749
9750impl UpdateGlossaryMetadata {
9751    pub fn new() -> Self {
9752        std::default::Default::default()
9753    }
9754
9755    /// Sets the value of [glossary][crate::model::UpdateGlossaryMetadata::glossary].
9756    ///
9757    /// # Example
9758    /// ```ignore,no_run
9759    /// # use google_cloud_translation_v3::model::UpdateGlossaryMetadata;
9760    /// use google_cloud_translation_v3::model::Glossary;
9761    /// let x = UpdateGlossaryMetadata::new().set_glossary(Glossary::default()/* use setters */);
9762    /// ```
9763    pub fn set_glossary<T>(mut self, v: T) -> Self
9764    where
9765        T: std::convert::Into<crate::model::Glossary>,
9766    {
9767        self.glossary = std::option::Option::Some(v.into());
9768        self
9769    }
9770
9771    /// Sets or clears the value of [glossary][crate::model::UpdateGlossaryMetadata::glossary].
9772    ///
9773    /// # Example
9774    /// ```ignore,no_run
9775    /// # use google_cloud_translation_v3::model::UpdateGlossaryMetadata;
9776    /// use google_cloud_translation_v3::model::Glossary;
9777    /// let x = UpdateGlossaryMetadata::new().set_or_clear_glossary(Some(Glossary::default()/* use setters */));
9778    /// let x = UpdateGlossaryMetadata::new().set_or_clear_glossary(None::<Glossary>);
9779    /// ```
9780    pub fn set_or_clear_glossary<T>(mut self, v: std::option::Option<T>) -> Self
9781    where
9782        T: std::convert::Into<crate::model::Glossary>,
9783    {
9784        self.glossary = v.map(|x| x.into());
9785        self
9786    }
9787
9788    /// Sets the value of [state][crate::model::UpdateGlossaryMetadata::state].
9789    ///
9790    /// # Example
9791    /// ```ignore,no_run
9792    /// # use google_cloud_translation_v3::model::UpdateGlossaryMetadata;
9793    /// use google_cloud_translation_v3::model::update_glossary_metadata::State;
9794    /// let x0 = UpdateGlossaryMetadata::new().set_state(State::Running);
9795    /// let x1 = UpdateGlossaryMetadata::new().set_state(State::Succeeded);
9796    /// let x2 = UpdateGlossaryMetadata::new().set_state(State::Failed);
9797    /// ```
9798    pub fn set_state<T: std::convert::Into<crate::model::update_glossary_metadata::State>>(
9799        mut self,
9800        v: T,
9801    ) -> Self {
9802        self.state = v.into();
9803        self
9804    }
9805
9806    /// Sets the value of [submit_time][crate::model::UpdateGlossaryMetadata::submit_time].
9807    ///
9808    /// # Example
9809    /// ```ignore,no_run
9810    /// # use google_cloud_translation_v3::model::UpdateGlossaryMetadata;
9811    /// use wkt::Timestamp;
9812    /// let x = UpdateGlossaryMetadata::new().set_submit_time(Timestamp::default()/* use setters */);
9813    /// ```
9814    pub fn set_submit_time<T>(mut self, v: T) -> Self
9815    where
9816        T: std::convert::Into<wkt::Timestamp>,
9817    {
9818        self.submit_time = std::option::Option::Some(v.into());
9819        self
9820    }
9821
9822    /// Sets or clears the value of [submit_time][crate::model::UpdateGlossaryMetadata::submit_time].
9823    ///
9824    /// # Example
9825    /// ```ignore,no_run
9826    /// # use google_cloud_translation_v3::model::UpdateGlossaryMetadata;
9827    /// use wkt::Timestamp;
9828    /// let x = UpdateGlossaryMetadata::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
9829    /// let x = UpdateGlossaryMetadata::new().set_or_clear_submit_time(None::<Timestamp>);
9830    /// ```
9831    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
9832    where
9833        T: std::convert::Into<wkt::Timestamp>,
9834    {
9835        self.submit_time = v.map(|x| x.into());
9836        self
9837    }
9838}
9839
9840impl wkt::message::Message for UpdateGlossaryMetadata {
9841    fn typename() -> &'static str {
9842        "type.googleapis.com/google.cloud.translation.v3.UpdateGlossaryMetadata"
9843    }
9844}
9845
9846/// Defines additional types related to [UpdateGlossaryMetadata].
9847pub mod update_glossary_metadata {
9848    #[allow(unused_imports)]
9849    use super::*;
9850
9851    /// Enumerates the possible states that the update request can be in.
9852    ///
9853    /// # Working with unknown values
9854    ///
9855    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9856    /// additional enum variants at any time. Adding new variants is not considered
9857    /// a breaking change. Applications should write their code in anticipation of:
9858    ///
9859    /// - New values appearing in future releases of the client library, **and**
9860    /// - New values received dynamically, without application changes.
9861    ///
9862    /// Please consult the [Working with enums] section in the user guide for some
9863    /// guidelines.
9864    ///
9865    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9866    #[derive(Clone, Debug, PartialEq)]
9867    #[non_exhaustive]
9868    pub enum State {
9869        /// Invalid.
9870        Unspecified,
9871        /// Request is being processed.
9872        Running,
9873        /// The glossary was successfully updated.
9874        Succeeded,
9875        /// Failed to update the glossary.
9876        Failed,
9877        /// Request is in the process of being canceled after caller invoked
9878        /// longrunning.Operations.CancelOperation on the request id.
9879        Cancelling,
9880        /// The glossary update request was successfully canceled.
9881        Cancelled,
9882        /// If set, the enum was initialized with an unknown value.
9883        ///
9884        /// Applications can examine the value using [State::value] or
9885        /// [State::name].
9886        UnknownValue(state::UnknownValue),
9887    }
9888
9889    #[doc(hidden)]
9890    pub mod state {
9891        #[allow(unused_imports)]
9892        use super::*;
9893        #[derive(Clone, Debug, PartialEq)]
9894        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9895    }
9896
9897    impl State {
9898        /// Gets the enum value.
9899        ///
9900        /// Returns `None` if the enum contains an unknown value deserialized from
9901        /// the string representation of enums.
9902        pub fn value(&self) -> std::option::Option<i32> {
9903            match self {
9904                Self::Unspecified => std::option::Option::Some(0),
9905                Self::Running => std::option::Option::Some(1),
9906                Self::Succeeded => std::option::Option::Some(2),
9907                Self::Failed => std::option::Option::Some(3),
9908                Self::Cancelling => std::option::Option::Some(4),
9909                Self::Cancelled => std::option::Option::Some(5),
9910                Self::UnknownValue(u) => u.0.value(),
9911            }
9912        }
9913
9914        /// Gets the enum value as a string.
9915        ///
9916        /// Returns `None` if the enum contains an unknown value deserialized from
9917        /// the integer representation of enums.
9918        pub fn name(&self) -> std::option::Option<&str> {
9919            match self {
9920                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9921                Self::Running => std::option::Option::Some("RUNNING"),
9922                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9923                Self::Failed => std::option::Option::Some("FAILED"),
9924                Self::Cancelling => std::option::Option::Some("CANCELLING"),
9925                Self::Cancelled => std::option::Option::Some("CANCELLED"),
9926                Self::UnknownValue(u) => u.0.name(),
9927            }
9928        }
9929    }
9930
9931    impl std::default::Default for State {
9932        fn default() -> Self {
9933            use std::convert::From;
9934            Self::from(0)
9935        }
9936    }
9937
9938    impl std::fmt::Display for State {
9939        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9940            wkt::internal::display_enum(f, self.name(), self.value())
9941        }
9942    }
9943
9944    impl std::convert::From<i32> for State {
9945        fn from(value: i32) -> Self {
9946            match value {
9947                0 => Self::Unspecified,
9948                1 => Self::Running,
9949                2 => Self::Succeeded,
9950                3 => Self::Failed,
9951                4 => Self::Cancelling,
9952                5 => Self::Cancelled,
9953                _ => Self::UnknownValue(state::UnknownValue(
9954                    wkt::internal::UnknownEnumValue::Integer(value),
9955                )),
9956            }
9957        }
9958    }
9959
9960    impl std::convert::From<&str> for State {
9961        fn from(value: &str) -> Self {
9962            use std::string::ToString;
9963            match value {
9964                "STATE_UNSPECIFIED" => Self::Unspecified,
9965                "RUNNING" => Self::Running,
9966                "SUCCEEDED" => Self::Succeeded,
9967                "FAILED" => Self::Failed,
9968                "CANCELLING" => Self::Cancelling,
9969                "CANCELLED" => Self::Cancelled,
9970                _ => Self::UnknownValue(state::UnknownValue(
9971                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9972                )),
9973            }
9974        }
9975    }
9976
9977    impl serde::ser::Serialize for State {
9978        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9979        where
9980            S: serde::Serializer,
9981        {
9982            match self {
9983                Self::Unspecified => serializer.serialize_i32(0),
9984                Self::Running => serializer.serialize_i32(1),
9985                Self::Succeeded => serializer.serialize_i32(2),
9986                Self::Failed => serializer.serialize_i32(3),
9987                Self::Cancelling => serializer.serialize_i32(4),
9988                Self::Cancelled => serializer.serialize_i32(5),
9989                Self::UnknownValue(u) => u.0.serialize(serializer),
9990            }
9991        }
9992    }
9993
9994    impl<'de> serde::de::Deserialize<'de> for State {
9995        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9996        where
9997            D: serde::Deserializer<'de>,
9998        {
9999            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10000                ".google.cloud.translation.v3.UpdateGlossaryMetadata.State",
10001            ))
10002        }
10003    }
10004}
10005
10006/// Stored in the
10007/// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
10008/// field returned by DeleteGlossary.
10009///
10010/// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
10011#[derive(Clone, Default, PartialEq)]
10012#[non_exhaustive]
10013pub struct DeleteGlossaryMetadata {
10014    /// The name of the glossary that is being deleted.
10015    pub name: std::string::String,
10016
10017    /// The current state of the glossary deletion operation.
10018    pub state: crate::model::delete_glossary_metadata::State,
10019
10020    /// The time when the operation was submitted to the server.
10021    pub submit_time: std::option::Option<wkt::Timestamp>,
10022
10023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10024}
10025
10026impl DeleteGlossaryMetadata {
10027    pub fn new() -> Self {
10028        std::default::Default::default()
10029    }
10030
10031    /// Sets the value of [name][crate::model::DeleteGlossaryMetadata::name].
10032    ///
10033    /// # Example
10034    /// ```ignore,no_run
10035    /// # use google_cloud_translation_v3::model::DeleteGlossaryMetadata;
10036    /// let x = DeleteGlossaryMetadata::new().set_name("example");
10037    /// ```
10038    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10039        self.name = v.into();
10040        self
10041    }
10042
10043    /// Sets the value of [state][crate::model::DeleteGlossaryMetadata::state].
10044    ///
10045    /// # Example
10046    /// ```ignore,no_run
10047    /// # use google_cloud_translation_v3::model::DeleteGlossaryMetadata;
10048    /// use google_cloud_translation_v3::model::delete_glossary_metadata::State;
10049    /// let x0 = DeleteGlossaryMetadata::new().set_state(State::Running);
10050    /// let x1 = DeleteGlossaryMetadata::new().set_state(State::Succeeded);
10051    /// let x2 = DeleteGlossaryMetadata::new().set_state(State::Failed);
10052    /// ```
10053    pub fn set_state<T: std::convert::Into<crate::model::delete_glossary_metadata::State>>(
10054        mut self,
10055        v: T,
10056    ) -> Self {
10057        self.state = v.into();
10058        self
10059    }
10060
10061    /// Sets the value of [submit_time][crate::model::DeleteGlossaryMetadata::submit_time].
10062    ///
10063    /// # Example
10064    /// ```ignore,no_run
10065    /// # use google_cloud_translation_v3::model::DeleteGlossaryMetadata;
10066    /// use wkt::Timestamp;
10067    /// let x = DeleteGlossaryMetadata::new().set_submit_time(Timestamp::default()/* use setters */);
10068    /// ```
10069    pub fn set_submit_time<T>(mut self, v: T) -> Self
10070    where
10071        T: std::convert::Into<wkt::Timestamp>,
10072    {
10073        self.submit_time = std::option::Option::Some(v.into());
10074        self
10075    }
10076
10077    /// Sets or clears the value of [submit_time][crate::model::DeleteGlossaryMetadata::submit_time].
10078    ///
10079    /// # Example
10080    /// ```ignore,no_run
10081    /// # use google_cloud_translation_v3::model::DeleteGlossaryMetadata;
10082    /// use wkt::Timestamp;
10083    /// let x = DeleteGlossaryMetadata::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
10084    /// let x = DeleteGlossaryMetadata::new().set_or_clear_submit_time(None::<Timestamp>);
10085    /// ```
10086    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
10087    where
10088        T: std::convert::Into<wkt::Timestamp>,
10089    {
10090        self.submit_time = v.map(|x| x.into());
10091        self
10092    }
10093}
10094
10095impl wkt::message::Message for DeleteGlossaryMetadata {
10096    fn typename() -> &'static str {
10097        "type.googleapis.com/google.cloud.translation.v3.DeleteGlossaryMetadata"
10098    }
10099}
10100
10101/// Defines additional types related to [DeleteGlossaryMetadata].
10102pub mod delete_glossary_metadata {
10103    #[allow(unused_imports)]
10104    use super::*;
10105
10106    /// Enumerates the possible states that the creation request can be in.
10107    ///
10108    /// # Working with unknown values
10109    ///
10110    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10111    /// additional enum variants at any time. Adding new variants is not considered
10112    /// a breaking change. Applications should write their code in anticipation of:
10113    ///
10114    /// - New values appearing in future releases of the client library, **and**
10115    /// - New values received dynamically, without application changes.
10116    ///
10117    /// Please consult the [Working with enums] section in the user guide for some
10118    /// guidelines.
10119    ///
10120    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10121    #[derive(Clone, Debug, PartialEq)]
10122    #[non_exhaustive]
10123    pub enum State {
10124        /// Invalid.
10125        Unspecified,
10126        /// Request is being processed.
10127        Running,
10128        /// The glossary was successfully deleted.
10129        Succeeded,
10130        /// Failed to delete the glossary.
10131        Failed,
10132        /// Request is in the process of being canceled after caller invoked
10133        /// longrunning.Operations.CancelOperation on the request id.
10134        Cancelling,
10135        /// The glossary deletion request was successfully canceled.
10136        Cancelled,
10137        /// If set, the enum was initialized with an unknown value.
10138        ///
10139        /// Applications can examine the value using [State::value] or
10140        /// [State::name].
10141        UnknownValue(state::UnknownValue),
10142    }
10143
10144    #[doc(hidden)]
10145    pub mod state {
10146        #[allow(unused_imports)]
10147        use super::*;
10148        #[derive(Clone, Debug, PartialEq)]
10149        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10150    }
10151
10152    impl State {
10153        /// Gets the enum value.
10154        ///
10155        /// Returns `None` if the enum contains an unknown value deserialized from
10156        /// the string representation of enums.
10157        pub fn value(&self) -> std::option::Option<i32> {
10158            match self {
10159                Self::Unspecified => std::option::Option::Some(0),
10160                Self::Running => std::option::Option::Some(1),
10161                Self::Succeeded => std::option::Option::Some(2),
10162                Self::Failed => std::option::Option::Some(3),
10163                Self::Cancelling => std::option::Option::Some(4),
10164                Self::Cancelled => std::option::Option::Some(5),
10165                Self::UnknownValue(u) => u.0.value(),
10166            }
10167        }
10168
10169        /// Gets the enum value as a string.
10170        ///
10171        /// Returns `None` if the enum contains an unknown value deserialized from
10172        /// the integer representation of enums.
10173        pub fn name(&self) -> std::option::Option<&str> {
10174            match self {
10175                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10176                Self::Running => std::option::Option::Some("RUNNING"),
10177                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
10178                Self::Failed => std::option::Option::Some("FAILED"),
10179                Self::Cancelling => std::option::Option::Some("CANCELLING"),
10180                Self::Cancelled => std::option::Option::Some("CANCELLED"),
10181                Self::UnknownValue(u) => u.0.name(),
10182            }
10183        }
10184    }
10185
10186    impl std::default::Default for State {
10187        fn default() -> Self {
10188            use std::convert::From;
10189            Self::from(0)
10190        }
10191    }
10192
10193    impl std::fmt::Display for State {
10194        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10195            wkt::internal::display_enum(f, self.name(), self.value())
10196        }
10197    }
10198
10199    impl std::convert::From<i32> for State {
10200        fn from(value: i32) -> Self {
10201            match value {
10202                0 => Self::Unspecified,
10203                1 => Self::Running,
10204                2 => Self::Succeeded,
10205                3 => Self::Failed,
10206                4 => Self::Cancelling,
10207                5 => Self::Cancelled,
10208                _ => Self::UnknownValue(state::UnknownValue(
10209                    wkt::internal::UnknownEnumValue::Integer(value),
10210                )),
10211            }
10212        }
10213    }
10214
10215    impl std::convert::From<&str> for State {
10216        fn from(value: &str) -> Self {
10217            use std::string::ToString;
10218            match value {
10219                "STATE_UNSPECIFIED" => Self::Unspecified,
10220                "RUNNING" => Self::Running,
10221                "SUCCEEDED" => Self::Succeeded,
10222                "FAILED" => Self::Failed,
10223                "CANCELLING" => Self::Cancelling,
10224                "CANCELLED" => Self::Cancelled,
10225                _ => Self::UnknownValue(state::UnknownValue(
10226                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10227                )),
10228            }
10229        }
10230    }
10231
10232    impl serde::ser::Serialize for State {
10233        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10234        where
10235            S: serde::Serializer,
10236        {
10237            match self {
10238                Self::Unspecified => serializer.serialize_i32(0),
10239                Self::Running => serializer.serialize_i32(1),
10240                Self::Succeeded => serializer.serialize_i32(2),
10241                Self::Failed => serializer.serialize_i32(3),
10242                Self::Cancelling => serializer.serialize_i32(4),
10243                Self::Cancelled => serializer.serialize_i32(5),
10244                Self::UnknownValue(u) => u.0.serialize(serializer),
10245            }
10246        }
10247    }
10248
10249    impl<'de> serde::de::Deserialize<'de> for State {
10250        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10251        where
10252            D: serde::Deserializer<'de>,
10253        {
10254            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10255                ".google.cloud.translation.v3.DeleteGlossaryMetadata.State",
10256            ))
10257        }
10258    }
10259}
10260
10261/// Stored in the
10262/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
10263/// field returned by DeleteGlossary.
10264///
10265/// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
10266#[derive(Clone, Default, PartialEq)]
10267#[non_exhaustive]
10268pub struct DeleteGlossaryResponse {
10269    /// The name of the deleted glossary.
10270    pub name: std::string::String,
10271
10272    /// The time when the operation was submitted to the server.
10273    pub submit_time: std::option::Option<wkt::Timestamp>,
10274
10275    /// The time when the glossary deletion is finished and
10276    /// [google.longrunning.Operation.done][google.longrunning.Operation.done] is
10277    /// set to true.
10278    ///
10279    /// [google.longrunning.Operation.done]: google_cloud_longrunning::model::Operation::done
10280    pub end_time: std::option::Option<wkt::Timestamp>,
10281
10282    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10283}
10284
10285impl DeleteGlossaryResponse {
10286    pub fn new() -> Self {
10287        std::default::Default::default()
10288    }
10289
10290    /// Sets the value of [name][crate::model::DeleteGlossaryResponse::name].
10291    ///
10292    /// # Example
10293    /// ```ignore,no_run
10294    /// # use google_cloud_translation_v3::model::DeleteGlossaryResponse;
10295    /// let x = DeleteGlossaryResponse::new().set_name("example");
10296    /// ```
10297    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10298        self.name = v.into();
10299        self
10300    }
10301
10302    /// Sets the value of [submit_time][crate::model::DeleteGlossaryResponse::submit_time].
10303    ///
10304    /// # Example
10305    /// ```ignore,no_run
10306    /// # use google_cloud_translation_v3::model::DeleteGlossaryResponse;
10307    /// use wkt::Timestamp;
10308    /// let x = DeleteGlossaryResponse::new().set_submit_time(Timestamp::default()/* use setters */);
10309    /// ```
10310    pub fn set_submit_time<T>(mut self, v: T) -> Self
10311    where
10312        T: std::convert::Into<wkt::Timestamp>,
10313    {
10314        self.submit_time = std::option::Option::Some(v.into());
10315        self
10316    }
10317
10318    /// Sets or clears the value of [submit_time][crate::model::DeleteGlossaryResponse::submit_time].
10319    ///
10320    /// # Example
10321    /// ```ignore,no_run
10322    /// # use google_cloud_translation_v3::model::DeleteGlossaryResponse;
10323    /// use wkt::Timestamp;
10324    /// let x = DeleteGlossaryResponse::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
10325    /// let x = DeleteGlossaryResponse::new().set_or_clear_submit_time(None::<Timestamp>);
10326    /// ```
10327    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
10328    where
10329        T: std::convert::Into<wkt::Timestamp>,
10330    {
10331        self.submit_time = v.map(|x| x.into());
10332        self
10333    }
10334
10335    /// Sets the value of [end_time][crate::model::DeleteGlossaryResponse::end_time].
10336    ///
10337    /// # Example
10338    /// ```ignore,no_run
10339    /// # use google_cloud_translation_v3::model::DeleteGlossaryResponse;
10340    /// use wkt::Timestamp;
10341    /// let x = DeleteGlossaryResponse::new().set_end_time(Timestamp::default()/* use setters */);
10342    /// ```
10343    pub fn set_end_time<T>(mut self, v: T) -> Self
10344    where
10345        T: std::convert::Into<wkt::Timestamp>,
10346    {
10347        self.end_time = std::option::Option::Some(v.into());
10348        self
10349    }
10350
10351    /// Sets or clears the value of [end_time][crate::model::DeleteGlossaryResponse::end_time].
10352    ///
10353    /// # Example
10354    /// ```ignore,no_run
10355    /// # use google_cloud_translation_v3::model::DeleteGlossaryResponse;
10356    /// use wkt::Timestamp;
10357    /// let x = DeleteGlossaryResponse::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
10358    /// let x = DeleteGlossaryResponse::new().set_or_clear_end_time(None::<Timestamp>);
10359    /// ```
10360    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
10361    where
10362        T: std::convert::Into<wkt::Timestamp>,
10363    {
10364        self.end_time = v.map(|x| x.into());
10365        self
10366    }
10367}
10368
10369impl wkt::message::Message for DeleteGlossaryResponse {
10370    fn typename() -> &'static str {
10371        "type.googleapis.com/google.cloud.translation.v3.DeleteGlossaryResponse"
10372    }
10373}
10374
10375/// The BatchTranslateDocument request.
10376#[derive(Clone, Default, PartialEq)]
10377#[non_exhaustive]
10378pub struct BatchTranslateDocumentRequest {
10379    /// Required. Location to make a regional call.
10380    ///
10381    /// Format: `projects/{project-number-or-id}/locations/{location-id}`.
10382    ///
10383    /// The `global` location is not supported for batch translation.
10384    ///
10385    /// Only AutoML Translation models or glossaries within the same region (have
10386    /// the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
10387    /// error is returned.
10388    pub parent: std::string::String,
10389
10390    /// Required. The ISO-639 language code of the input document if known, for
10391    /// example, "en-US" or "sr-Latn". Supported language codes are listed in
10392    /// [Language Support](https://cloud.google.com/translate/docs/languages).
10393    pub source_language_code: std::string::String,
10394
10395    /// Required. The ISO-639 language code to use for translation of the input
10396    /// document. Specify up to 10 language codes here. Supported language codes
10397    /// are listed in [Language
10398    /// Support](https://cloud.google.com/translate/docs/languages).
10399    pub target_language_codes: std::vec::Vec<std::string::String>,
10400
10401    /// Required. Input configurations.
10402    /// The total number of files matched should be <= 100.
10403    /// The total content size to translate should be <= 100M Unicode codepoints.
10404    /// The files must use UTF-8 encoding.
10405    pub input_configs: std::vec::Vec<crate::model::BatchDocumentInputConfig>,
10406
10407    /// Required. Output configuration.
10408    /// If 2 input configs match to the same file (that is, same input path),
10409    /// we don't generate output for duplicate inputs.
10410    pub output_config: std::option::Option<crate::model::BatchDocumentOutputConfig>,
10411
10412    /// Optional. The models to use for translation. Map's key is target language
10413    /// code. Map's value is the model name. Value can be a built-in general model,
10414    /// or an AutoML Translation model.
10415    ///
10416    /// The value format depends on model type:
10417    ///
10418    /// - AutoML Translation models:
10419    ///   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
10420    ///
10421    /// - General (built-in) models:
10422    ///   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
10423    ///
10424    ///
10425    /// If the map is empty or a specific model is
10426    /// not requested for a language pair, then default google model (nmt) is used.
10427    pub models: std::collections::HashMap<std::string::String, std::string::String>,
10428
10429    /// Optional. Glossaries to be applied. It's keyed by target language code.
10430    pub glossaries:
10431        std::collections::HashMap<std::string::String, crate::model::TranslateTextGlossaryConfig>,
10432
10433    /// Optional. The file format conversion map that is applied to all input
10434    /// files. The map key is the original mime_type. The map value is the target
10435    /// mime_type of translated documents.
10436    ///
10437    /// Supported file format conversion includes:
10438    ///
10439    /// - `application/pdf` to
10440    ///   `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
10441    ///
10442    /// If nothing specified, output files will be in the same format as the
10443    /// original file.
10444    pub format_conversions: std::collections::HashMap<std::string::String, std::string::String>,
10445
10446    /// Optional. This flag is to support user customized attribution.
10447    /// If not provided, the default is `Machine Translated by Google`.
10448    /// Customized attribution should follow rules in
10449    /// <https://cloud.google.com/translate/attribution#attribution_and_logos>
10450    pub customized_attribution: std::string::String,
10451
10452    /// Optional. If true, use the text removal server to remove the shadow text on
10453    /// background image for native pdf translation.
10454    /// Shadow removal feature can only be enabled when
10455    /// is_translate_native_pdf_only: false && pdf_native_only: false
10456    pub enable_shadow_removal_native_pdf: bool,
10457
10458    /// Optional. If true, enable auto rotation correction in DVS.
10459    pub enable_rotation_correction: bool,
10460
10461    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10462}
10463
10464impl BatchTranslateDocumentRequest {
10465    pub fn new() -> Self {
10466        std::default::Default::default()
10467    }
10468
10469    /// Sets the value of [parent][crate::model::BatchTranslateDocumentRequest::parent].
10470    ///
10471    /// # Example
10472    /// ```ignore,no_run
10473    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10474    /// let x = BatchTranslateDocumentRequest::new().set_parent("example");
10475    /// ```
10476    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10477        self.parent = v.into();
10478        self
10479    }
10480
10481    /// Sets the value of [source_language_code][crate::model::BatchTranslateDocumentRequest::source_language_code].
10482    ///
10483    /// # Example
10484    /// ```ignore,no_run
10485    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10486    /// let x = BatchTranslateDocumentRequest::new().set_source_language_code("example");
10487    /// ```
10488    pub fn set_source_language_code<T: std::convert::Into<std::string::String>>(
10489        mut self,
10490        v: T,
10491    ) -> Self {
10492        self.source_language_code = v.into();
10493        self
10494    }
10495
10496    /// Sets the value of [target_language_codes][crate::model::BatchTranslateDocumentRequest::target_language_codes].
10497    ///
10498    /// # Example
10499    /// ```ignore,no_run
10500    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10501    /// let x = BatchTranslateDocumentRequest::new().set_target_language_codes(["a", "b", "c"]);
10502    /// ```
10503    pub fn set_target_language_codes<T, V>(mut self, v: T) -> Self
10504    where
10505        T: std::iter::IntoIterator<Item = V>,
10506        V: std::convert::Into<std::string::String>,
10507    {
10508        use std::iter::Iterator;
10509        self.target_language_codes = v.into_iter().map(|i| i.into()).collect();
10510        self
10511    }
10512
10513    /// Sets the value of [input_configs][crate::model::BatchTranslateDocumentRequest::input_configs].
10514    ///
10515    /// # Example
10516    /// ```ignore,no_run
10517    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10518    /// use google_cloud_translation_v3::model::BatchDocumentInputConfig;
10519    /// let x = BatchTranslateDocumentRequest::new()
10520    ///     .set_input_configs([
10521    ///         BatchDocumentInputConfig::default()/* use setters */,
10522    ///         BatchDocumentInputConfig::default()/* use (different) setters */,
10523    ///     ]);
10524    /// ```
10525    pub fn set_input_configs<T, V>(mut self, v: T) -> Self
10526    where
10527        T: std::iter::IntoIterator<Item = V>,
10528        V: std::convert::Into<crate::model::BatchDocumentInputConfig>,
10529    {
10530        use std::iter::Iterator;
10531        self.input_configs = v.into_iter().map(|i| i.into()).collect();
10532        self
10533    }
10534
10535    /// Sets the value of [output_config][crate::model::BatchTranslateDocumentRequest::output_config].
10536    ///
10537    /// # Example
10538    /// ```ignore,no_run
10539    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10540    /// use google_cloud_translation_v3::model::BatchDocumentOutputConfig;
10541    /// let x = BatchTranslateDocumentRequest::new().set_output_config(BatchDocumentOutputConfig::default()/* use setters */);
10542    /// ```
10543    pub fn set_output_config<T>(mut self, v: T) -> Self
10544    where
10545        T: std::convert::Into<crate::model::BatchDocumentOutputConfig>,
10546    {
10547        self.output_config = std::option::Option::Some(v.into());
10548        self
10549    }
10550
10551    /// Sets or clears the value of [output_config][crate::model::BatchTranslateDocumentRequest::output_config].
10552    ///
10553    /// # Example
10554    /// ```ignore,no_run
10555    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10556    /// use google_cloud_translation_v3::model::BatchDocumentOutputConfig;
10557    /// let x = BatchTranslateDocumentRequest::new().set_or_clear_output_config(Some(BatchDocumentOutputConfig::default()/* use setters */));
10558    /// let x = BatchTranslateDocumentRequest::new().set_or_clear_output_config(None::<BatchDocumentOutputConfig>);
10559    /// ```
10560    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10561    where
10562        T: std::convert::Into<crate::model::BatchDocumentOutputConfig>,
10563    {
10564        self.output_config = v.map(|x| x.into());
10565        self
10566    }
10567
10568    /// Sets the value of [models][crate::model::BatchTranslateDocumentRequest::models].
10569    ///
10570    /// # Example
10571    /// ```ignore,no_run
10572    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10573    /// let x = BatchTranslateDocumentRequest::new().set_models([
10574    ///     ("key0", "abc"),
10575    ///     ("key1", "xyz"),
10576    /// ]);
10577    /// ```
10578    pub fn set_models<T, K, V>(mut self, v: T) -> Self
10579    where
10580        T: std::iter::IntoIterator<Item = (K, V)>,
10581        K: std::convert::Into<std::string::String>,
10582        V: std::convert::Into<std::string::String>,
10583    {
10584        use std::iter::Iterator;
10585        self.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10586        self
10587    }
10588
10589    /// Sets the value of [glossaries][crate::model::BatchTranslateDocumentRequest::glossaries].
10590    ///
10591    /// # Example
10592    /// ```ignore,no_run
10593    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10594    /// use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
10595    /// let x = BatchTranslateDocumentRequest::new().set_glossaries([
10596    ///     ("key0", TranslateTextGlossaryConfig::default()/* use setters */),
10597    ///     ("key1", TranslateTextGlossaryConfig::default()/* use (different) setters */),
10598    /// ]);
10599    /// ```
10600    pub fn set_glossaries<T, K, V>(mut self, v: T) -> Self
10601    where
10602        T: std::iter::IntoIterator<Item = (K, V)>,
10603        K: std::convert::Into<std::string::String>,
10604        V: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
10605    {
10606        use std::iter::Iterator;
10607        self.glossaries = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10608        self
10609    }
10610
10611    /// Sets the value of [format_conversions][crate::model::BatchTranslateDocumentRequest::format_conversions].
10612    ///
10613    /// # Example
10614    /// ```ignore,no_run
10615    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10616    /// let x = BatchTranslateDocumentRequest::new().set_format_conversions([
10617    ///     ("key0", "abc"),
10618    ///     ("key1", "xyz"),
10619    /// ]);
10620    /// ```
10621    pub fn set_format_conversions<T, K, V>(mut self, v: T) -> Self
10622    where
10623        T: std::iter::IntoIterator<Item = (K, V)>,
10624        K: std::convert::Into<std::string::String>,
10625        V: std::convert::Into<std::string::String>,
10626    {
10627        use std::iter::Iterator;
10628        self.format_conversions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10629        self
10630    }
10631
10632    /// Sets the value of [customized_attribution][crate::model::BatchTranslateDocumentRequest::customized_attribution].
10633    ///
10634    /// # Example
10635    /// ```ignore,no_run
10636    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10637    /// let x = BatchTranslateDocumentRequest::new().set_customized_attribution("example");
10638    /// ```
10639    pub fn set_customized_attribution<T: std::convert::Into<std::string::String>>(
10640        mut self,
10641        v: T,
10642    ) -> Self {
10643        self.customized_attribution = v.into();
10644        self
10645    }
10646
10647    /// Sets the value of [enable_shadow_removal_native_pdf][crate::model::BatchTranslateDocumentRequest::enable_shadow_removal_native_pdf].
10648    ///
10649    /// # Example
10650    /// ```ignore,no_run
10651    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10652    /// let x = BatchTranslateDocumentRequest::new().set_enable_shadow_removal_native_pdf(true);
10653    /// ```
10654    pub fn set_enable_shadow_removal_native_pdf<T: std::convert::Into<bool>>(
10655        mut self,
10656        v: T,
10657    ) -> Self {
10658        self.enable_shadow_removal_native_pdf = v.into();
10659        self
10660    }
10661
10662    /// Sets the value of [enable_rotation_correction][crate::model::BatchTranslateDocumentRequest::enable_rotation_correction].
10663    ///
10664    /// # Example
10665    /// ```ignore,no_run
10666    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentRequest;
10667    /// let x = BatchTranslateDocumentRequest::new().set_enable_rotation_correction(true);
10668    /// ```
10669    pub fn set_enable_rotation_correction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10670        self.enable_rotation_correction = v.into();
10671        self
10672    }
10673}
10674
10675impl wkt::message::Message for BatchTranslateDocumentRequest {
10676    fn typename() -> &'static str {
10677        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateDocumentRequest"
10678    }
10679}
10680
10681/// Input configuration for BatchTranslateDocument request.
10682#[derive(Clone, Default, PartialEq)]
10683#[non_exhaustive]
10684pub struct BatchDocumentInputConfig {
10685    /// Specify the input.
10686    pub source: std::option::Option<crate::model::batch_document_input_config::Source>,
10687
10688    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10689}
10690
10691impl BatchDocumentInputConfig {
10692    pub fn new() -> Self {
10693        std::default::Default::default()
10694    }
10695
10696    /// Sets the value of [source][crate::model::BatchDocumentInputConfig::source].
10697    ///
10698    /// Note that all the setters affecting `source` are mutually
10699    /// exclusive.
10700    ///
10701    /// # Example
10702    /// ```ignore,no_run
10703    /// # use google_cloud_translation_v3::model::BatchDocumentInputConfig;
10704    /// use google_cloud_translation_v3::model::GcsSource;
10705    /// let x = BatchDocumentInputConfig::new().set_source(Some(
10706    ///     google_cloud_translation_v3::model::batch_document_input_config::Source::GcsSource(GcsSource::default().into())));
10707    /// ```
10708    pub fn set_source<
10709        T: std::convert::Into<std::option::Option<crate::model::batch_document_input_config::Source>>,
10710    >(
10711        mut self,
10712        v: T,
10713    ) -> Self {
10714        self.source = v.into();
10715        self
10716    }
10717
10718    /// The value of [source][crate::model::BatchDocumentInputConfig::source]
10719    /// if it holds a `GcsSource`, `None` if the field is not set or
10720    /// holds a different branch.
10721    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
10722        #[allow(unreachable_patterns)]
10723        self.source.as_ref().and_then(|v| match v {
10724            crate::model::batch_document_input_config::Source::GcsSource(v) => {
10725                std::option::Option::Some(v)
10726            }
10727            _ => std::option::Option::None,
10728        })
10729    }
10730
10731    /// Sets the value of [source][crate::model::BatchDocumentInputConfig::source]
10732    /// to hold a `GcsSource`.
10733    ///
10734    /// Note that all the setters affecting `source` are
10735    /// mutually exclusive.
10736    ///
10737    /// # Example
10738    /// ```ignore,no_run
10739    /// # use google_cloud_translation_v3::model::BatchDocumentInputConfig;
10740    /// use google_cloud_translation_v3::model::GcsSource;
10741    /// let x = BatchDocumentInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
10742    /// assert!(x.gcs_source().is_some());
10743    /// ```
10744    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
10745        mut self,
10746        v: T,
10747    ) -> Self {
10748        self.source = std::option::Option::Some(
10749            crate::model::batch_document_input_config::Source::GcsSource(v.into()),
10750        );
10751        self
10752    }
10753}
10754
10755impl wkt::message::Message for BatchDocumentInputConfig {
10756    fn typename() -> &'static str {
10757        "type.googleapis.com/google.cloud.translation.v3.BatchDocumentInputConfig"
10758    }
10759}
10760
10761/// Defines additional types related to [BatchDocumentInputConfig].
10762pub mod batch_document_input_config {
10763    #[allow(unused_imports)]
10764    use super::*;
10765
10766    /// Specify the input.
10767    #[derive(Clone, Debug, PartialEq)]
10768    #[non_exhaustive]
10769    pub enum Source {
10770        /// Google Cloud Storage location for the source input.
10771        /// This can be a single file (for example,
10772        /// `gs://translation-test/input.docx`) or a wildcard (for example,
10773        /// `gs://translation-test/*`).
10774        ///
10775        /// File mime type is determined based on extension. Supported mime type
10776        /// includes:
10777        ///
10778        /// - `pdf`, application/pdf
10779        /// - `docx`,
10780        ///   application/vnd.openxmlformats-officedocument.wordprocessingml.document
10781        /// - `pptx`,
10782        ///   application/vnd.openxmlformats-officedocument.presentationml.presentation
10783        /// - `xlsx`,
10784        ///   application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
10785        ///
10786        /// The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
10787        /// The max file size to support for `.pdf` is 1GB and the max page limit is
10788        /// 1000 pages.
10789        /// The max file size to support for all input documents is 1GB.
10790        GcsSource(std::boxed::Box<crate::model::GcsSource>),
10791    }
10792}
10793
10794/// Output configuration for BatchTranslateDocument request.
10795#[derive(Clone, Default, PartialEq)]
10796#[non_exhaustive]
10797pub struct BatchDocumentOutputConfig {
10798    /// The destination of output. The destination directory provided must exist
10799    /// and be empty.
10800    pub destination: std::option::Option<crate::model::batch_document_output_config::Destination>,
10801
10802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10803}
10804
10805impl BatchDocumentOutputConfig {
10806    pub fn new() -> Self {
10807        std::default::Default::default()
10808    }
10809
10810    /// Sets the value of [destination][crate::model::BatchDocumentOutputConfig::destination].
10811    ///
10812    /// Note that all the setters affecting `destination` are mutually
10813    /// exclusive.
10814    ///
10815    /// # Example
10816    /// ```ignore,no_run
10817    /// # use google_cloud_translation_v3::model::BatchDocumentOutputConfig;
10818    /// use google_cloud_translation_v3::model::GcsDestination;
10819    /// let x = BatchDocumentOutputConfig::new().set_destination(Some(
10820    ///     google_cloud_translation_v3::model::batch_document_output_config::Destination::GcsDestination(GcsDestination::default().into())));
10821    /// ```
10822    pub fn set_destination<
10823        T: std::convert::Into<
10824                std::option::Option<crate::model::batch_document_output_config::Destination>,
10825            >,
10826    >(
10827        mut self,
10828        v: T,
10829    ) -> Self {
10830        self.destination = v.into();
10831        self
10832    }
10833
10834    /// The value of [destination][crate::model::BatchDocumentOutputConfig::destination]
10835    /// if it holds a `GcsDestination`, `None` if the field is not set or
10836    /// holds a different branch.
10837    pub fn gcs_destination(
10838        &self,
10839    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
10840        #[allow(unreachable_patterns)]
10841        self.destination.as_ref().and_then(|v| match v {
10842            crate::model::batch_document_output_config::Destination::GcsDestination(v) => {
10843                std::option::Option::Some(v)
10844            }
10845            _ => std::option::Option::None,
10846        })
10847    }
10848
10849    /// Sets the value of [destination][crate::model::BatchDocumentOutputConfig::destination]
10850    /// to hold a `GcsDestination`.
10851    ///
10852    /// Note that all the setters affecting `destination` are
10853    /// mutually exclusive.
10854    ///
10855    /// # Example
10856    /// ```ignore,no_run
10857    /// # use google_cloud_translation_v3::model::BatchDocumentOutputConfig;
10858    /// use google_cloud_translation_v3::model::GcsDestination;
10859    /// let x = BatchDocumentOutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
10860    /// assert!(x.gcs_destination().is_some());
10861    /// ```
10862    pub fn set_gcs_destination<
10863        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
10864    >(
10865        mut self,
10866        v: T,
10867    ) -> Self {
10868        self.destination = std::option::Option::Some(
10869            crate::model::batch_document_output_config::Destination::GcsDestination(v.into()),
10870        );
10871        self
10872    }
10873}
10874
10875impl wkt::message::Message for BatchDocumentOutputConfig {
10876    fn typename() -> &'static str {
10877        "type.googleapis.com/google.cloud.translation.v3.BatchDocumentOutputConfig"
10878    }
10879}
10880
10881/// Defines additional types related to [BatchDocumentOutputConfig].
10882pub mod batch_document_output_config {
10883    #[allow(unused_imports)]
10884    use super::*;
10885
10886    /// The destination of output. The destination directory provided must exist
10887    /// and be empty.
10888    #[derive(Clone, Debug, PartialEq)]
10889    #[non_exhaustive]
10890    pub enum Destination {
10891        /// Google Cloud Storage destination for output content.
10892        /// For every single input document (for example, gs://a/b/c.[extension]), we
10893        /// generate at most 2 * n output files. (n is the # of target_language_codes
10894        /// in the BatchTranslateDocumentRequest).
10895        ///
10896        /// While the input documents are being processed, we write/update an index
10897        /// file `index.csv` under `gcs_destination.output_uri_prefix` (for example,
10898        /// gs://translation_output/index.csv) The index file is generated/updated as
10899        /// new files are being translated. The format is:
10900        ///
10901        /// input_document,target_language_code,translation_output,error_output,
10902        /// glossary_translation_output,glossary_error_output
10903        ///
10904        /// `input_document` is one file we matched using gcs_source.input_uri.
10905        /// `target_language_code` is provided in the request.
10906        /// `translation_output` contains the translations. (details provided below)
10907        /// `error_output` contains the error message during processing of the file.
10908        /// Both translations_file and errors_file could be empty strings if we have
10909        /// no content to output.
10910        /// `glossary_translation_output` and `glossary_error_output` are the
10911        /// translated output/error when we apply glossaries. They could also be
10912        /// empty if we have no content to output.
10913        ///
10914        /// Once a row is present in index.csv, the input/output matching never
10915        /// changes. Callers should also expect all the content in input_file are
10916        /// processed and ready to be consumed (that is, no partial output file is
10917        /// written).
10918        ///
10919        /// Since index.csv will be keeping updated during the process, please make
10920        /// sure there is no custom retention policy applied on the output bucket
10921        /// that may avoid file updating.
10922        /// (<https://cloud.google.com/storage/docs/bucket-lock#retention-policy>)
10923        ///
10924        /// The naming format of translation output files follows (for target
10925        /// language code [trg]): `translation_output`:
10926        /// `gs://translation_output/a_b_c_[trg]_translation.[extension]`
10927        /// `glossary_translation_output`:
10928        /// `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The
10929        /// output document will maintain the same file format as the input document.
10930        ///
10931        /// The naming format of error output files follows (for target language code
10932        /// [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt`
10933        /// `glossary_error_output`:
10934        /// `gs://translation_test/a_b_c_[trg]_glossary_translation.txt`. The error
10935        /// output is a txt file containing error details.
10936        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
10937    }
10938}
10939
10940/// Stored in the
10941/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
10942/// field returned by BatchTranslateDocument if at least one document is
10943/// translated successfully.
10944///
10945/// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
10946#[derive(Clone, Default, PartialEq)]
10947#[non_exhaustive]
10948pub struct BatchTranslateDocumentResponse {
10949    /// Total number of pages to translate in all documents. Documents without
10950    /// clear page definition (such as XLSX) are not counted.
10951    pub total_pages: i64,
10952
10953    /// Number of successfully translated pages in all documents. Documents without
10954    /// clear page definition (such as XLSX) are not counted.
10955    pub translated_pages: i64,
10956
10957    /// Number of pages that failed to process in all documents. Documents without
10958    /// clear page definition (such as XLSX) are not counted.
10959    pub failed_pages: i64,
10960
10961    /// Number of billable pages in documents with clear page definition (such as
10962    /// PDF, DOCX, PPTX)
10963    pub total_billable_pages: i64,
10964
10965    /// Total number of characters (Unicode codepoints) in all documents.
10966    pub total_characters: i64,
10967
10968    /// Number of successfully translated characters (Unicode codepoints) in all
10969    /// documents.
10970    pub translated_characters: i64,
10971
10972    /// Number of characters that have failed to process (Unicode codepoints) in
10973    /// all documents.
10974    pub failed_characters: i64,
10975
10976    /// Number of billable characters (Unicode codepoints) in documents without
10977    /// clear page definition, such as XLSX.
10978    pub total_billable_characters: i64,
10979
10980    /// Time when the operation was submitted.
10981    pub submit_time: std::option::Option<wkt::Timestamp>,
10982
10983    /// The time when the operation is finished and
10984    /// [google.longrunning.Operation.done][google.longrunning.Operation.done] is
10985    /// set to true.
10986    ///
10987    /// [google.longrunning.Operation.done]: google_cloud_longrunning::model::Operation::done
10988    pub end_time: std::option::Option<wkt::Timestamp>,
10989
10990    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10991}
10992
10993impl BatchTranslateDocumentResponse {
10994    pub fn new() -> Self {
10995        std::default::Default::default()
10996    }
10997
10998    /// Sets the value of [total_pages][crate::model::BatchTranslateDocumentResponse::total_pages].
10999    ///
11000    /// # Example
11001    /// ```ignore,no_run
11002    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11003    /// let x = BatchTranslateDocumentResponse::new().set_total_pages(42);
11004    /// ```
11005    pub fn set_total_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11006        self.total_pages = v.into();
11007        self
11008    }
11009
11010    /// Sets the value of [translated_pages][crate::model::BatchTranslateDocumentResponse::translated_pages].
11011    ///
11012    /// # Example
11013    /// ```ignore,no_run
11014    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11015    /// let x = BatchTranslateDocumentResponse::new().set_translated_pages(42);
11016    /// ```
11017    pub fn set_translated_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11018        self.translated_pages = v.into();
11019        self
11020    }
11021
11022    /// Sets the value of [failed_pages][crate::model::BatchTranslateDocumentResponse::failed_pages].
11023    ///
11024    /// # Example
11025    /// ```ignore,no_run
11026    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11027    /// let x = BatchTranslateDocumentResponse::new().set_failed_pages(42);
11028    /// ```
11029    pub fn set_failed_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11030        self.failed_pages = v.into();
11031        self
11032    }
11033
11034    /// Sets the value of [total_billable_pages][crate::model::BatchTranslateDocumentResponse::total_billable_pages].
11035    ///
11036    /// # Example
11037    /// ```ignore,no_run
11038    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11039    /// let x = BatchTranslateDocumentResponse::new().set_total_billable_pages(42);
11040    /// ```
11041    pub fn set_total_billable_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11042        self.total_billable_pages = v.into();
11043        self
11044    }
11045
11046    /// Sets the value of [total_characters][crate::model::BatchTranslateDocumentResponse::total_characters].
11047    ///
11048    /// # Example
11049    /// ```ignore,no_run
11050    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11051    /// let x = BatchTranslateDocumentResponse::new().set_total_characters(42);
11052    /// ```
11053    pub fn set_total_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11054        self.total_characters = v.into();
11055        self
11056    }
11057
11058    /// Sets the value of [translated_characters][crate::model::BatchTranslateDocumentResponse::translated_characters].
11059    ///
11060    /// # Example
11061    /// ```ignore,no_run
11062    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11063    /// let x = BatchTranslateDocumentResponse::new().set_translated_characters(42);
11064    /// ```
11065    pub fn set_translated_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11066        self.translated_characters = v.into();
11067        self
11068    }
11069
11070    /// Sets the value of [failed_characters][crate::model::BatchTranslateDocumentResponse::failed_characters].
11071    ///
11072    /// # Example
11073    /// ```ignore,no_run
11074    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11075    /// let x = BatchTranslateDocumentResponse::new().set_failed_characters(42);
11076    /// ```
11077    pub fn set_failed_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11078        self.failed_characters = v.into();
11079        self
11080    }
11081
11082    /// Sets the value of [total_billable_characters][crate::model::BatchTranslateDocumentResponse::total_billable_characters].
11083    ///
11084    /// # Example
11085    /// ```ignore,no_run
11086    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11087    /// let x = BatchTranslateDocumentResponse::new().set_total_billable_characters(42);
11088    /// ```
11089    pub fn set_total_billable_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11090        self.total_billable_characters = v.into();
11091        self
11092    }
11093
11094    /// Sets the value of [submit_time][crate::model::BatchTranslateDocumentResponse::submit_time].
11095    ///
11096    /// # Example
11097    /// ```ignore,no_run
11098    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11099    /// use wkt::Timestamp;
11100    /// let x = BatchTranslateDocumentResponse::new().set_submit_time(Timestamp::default()/* use setters */);
11101    /// ```
11102    pub fn set_submit_time<T>(mut self, v: T) -> Self
11103    where
11104        T: std::convert::Into<wkt::Timestamp>,
11105    {
11106        self.submit_time = std::option::Option::Some(v.into());
11107        self
11108    }
11109
11110    /// Sets or clears the value of [submit_time][crate::model::BatchTranslateDocumentResponse::submit_time].
11111    ///
11112    /// # Example
11113    /// ```ignore,no_run
11114    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11115    /// use wkt::Timestamp;
11116    /// let x = BatchTranslateDocumentResponse::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
11117    /// let x = BatchTranslateDocumentResponse::new().set_or_clear_submit_time(None::<Timestamp>);
11118    /// ```
11119    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
11120    where
11121        T: std::convert::Into<wkt::Timestamp>,
11122    {
11123        self.submit_time = v.map(|x| x.into());
11124        self
11125    }
11126
11127    /// Sets the value of [end_time][crate::model::BatchTranslateDocumentResponse::end_time].
11128    ///
11129    /// # Example
11130    /// ```ignore,no_run
11131    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11132    /// use wkt::Timestamp;
11133    /// let x = BatchTranslateDocumentResponse::new().set_end_time(Timestamp::default()/* use setters */);
11134    /// ```
11135    pub fn set_end_time<T>(mut self, v: T) -> Self
11136    where
11137        T: std::convert::Into<wkt::Timestamp>,
11138    {
11139        self.end_time = std::option::Option::Some(v.into());
11140        self
11141    }
11142
11143    /// Sets or clears the value of [end_time][crate::model::BatchTranslateDocumentResponse::end_time].
11144    ///
11145    /// # Example
11146    /// ```ignore,no_run
11147    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentResponse;
11148    /// use wkt::Timestamp;
11149    /// let x = BatchTranslateDocumentResponse::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
11150    /// let x = BatchTranslateDocumentResponse::new().set_or_clear_end_time(None::<Timestamp>);
11151    /// ```
11152    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
11153    where
11154        T: std::convert::Into<wkt::Timestamp>,
11155    {
11156        self.end_time = v.map(|x| x.into());
11157        self
11158    }
11159}
11160
11161impl wkt::message::Message for BatchTranslateDocumentResponse {
11162    fn typename() -> &'static str {
11163        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateDocumentResponse"
11164    }
11165}
11166
11167/// State metadata for the batch translation operation.
11168#[derive(Clone, Default, PartialEq)]
11169#[non_exhaustive]
11170pub struct BatchTranslateDocumentMetadata {
11171    /// The state of the operation.
11172    pub state: crate::model::batch_translate_document_metadata::State,
11173
11174    /// Total number of pages to translate in all documents so far. Documents
11175    /// without clear page definition (such as XLSX) are not counted.
11176    pub total_pages: i64,
11177
11178    /// Number of successfully translated pages in all documents so far. Documents
11179    /// without clear page definition (such as XLSX) are not counted.
11180    pub translated_pages: i64,
11181
11182    /// Number of pages that failed to process in all documents so far. Documents
11183    /// without clear page definition (such as XLSX) are not counted.
11184    pub failed_pages: i64,
11185
11186    /// Number of billable pages in documents with clear page definition (such as
11187    /// PDF, DOCX, PPTX) so far.
11188    pub total_billable_pages: i64,
11189
11190    /// Total number of characters (Unicode codepoints) in all documents so far.
11191    pub total_characters: i64,
11192
11193    /// Number of successfully translated characters (Unicode codepoints) in all
11194    /// documents so far.
11195    pub translated_characters: i64,
11196
11197    /// Number of characters that have failed to process (Unicode codepoints) in
11198    /// all documents so far.
11199    pub failed_characters: i64,
11200
11201    /// Number of billable characters (Unicode codepoints) in documents without
11202    /// clear page definition (such as XLSX) so far.
11203    pub total_billable_characters: i64,
11204
11205    /// Time when the operation was submitted.
11206    pub submit_time: std::option::Option<wkt::Timestamp>,
11207
11208    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11209}
11210
11211impl BatchTranslateDocumentMetadata {
11212    pub fn new() -> Self {
11213        std::default::Default::default()
11214    }
11215
11216    /// Sets the value of [state][crate::model::BatchTranslateDocumentMetadata::state].
11217    ///
11218    /// # Example
11219    /// ```ignore,no_run
11220    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11221    /// use google_cloud_translation_v3::model::batch_translate_document_metadata::State;
11222    /// let x0 = BatchTranslateDocumentMetadata::new().set_state(State::Running);
11223    /// let x1 = BatchTranslateDocumentMetadata::new().set_state(State::Succeeded);
11224    /// let x2 = BatchTranslateDocumentMetadata::new().set_state(State::Failed);
11225    /// ```
11226    pub fn set_state<
11227        T: std::convert::Into<crate::model::batch_translate_document_metadata::State>,
11228    >(
11229        mut self,
11230        v: T,
11231    ) -> Self {
11232        self.state = v.into();
11233        self
11234    }
11235
11236    /// Sets the value of [total_pages][crate::model::BatchTranslateDocumentMetadata::total_pages].
11237    ///
11238    /// # Example
11239    /// ```ignore,no_run
11240    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11241    /// let x = BatchTranslateDocumentMetadata::new().set_total_pages(42);
11242    /// ```
11243    pub fn set_total_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11244        self.total_pages = v.into();
11245        self
11246    }
11247
11248    /// Sets the value of [translated_pages][crate::model::BatchTranslateDocumentMetadata::translated_pages].
11249    ///
11250    /// # Example
11251    /// ```ignore,no_run
11252    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11253    /// let x = BatchTranslateDocumentMetadata::new().set_translated_pages(42);
11254    /// ```
11255    pub fn set_translated_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11256        self.translated_pages = v.into();
11257        self
11258    }
11259
11260    /// Sets the value of [failed_pages][crate::model::BatchTranslateDocumentMetadata::failed_pages].
11261    ///
11262    /// # Example
11263    /// ```ignore,no_run
11264    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11265    /// let x = BatchTranslateDocumentMetadata::new().set_failed_pages(42);
11266    /// ```
11267    pub fn set_failed_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11268        self.failed_pages = v.into();
11269        self
11270    }
11271
11272    /// Sets the value of [total_billable_pages][crate::model::BatchTranslateDocumentMetadata::total_billable_pages].
11273    ///
11274    /// # Example
11275    /// ```ignore,no_run
11276    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11277    /// let x = BatchTranslateDocumentMetadata::new().set_total_billable_pages(42);
11278    /// ```
11279    pub fn set_total_billable_pages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11280        self.total_billable_pages = v.into();
11281        self
11282    }
11283
11284    /// Sets the value of [total_characters][crate::model::BatchTranslateDocumentMetadata::total_characters].
11285    ///
11286    /// # Example
11287    /// ```ignore,no_run
11288    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11289    /// let x = BatchTranslateDocumentMetadata::new().set_total_characters(42);
11290    /// ```
11291    pub fn set_total_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11292        self.total_characters = v.into();
11293        self
11294    }
11295
11296    /// Sets the value of [translated_characters][crate::model::BatchTranslateDocumentMetadata::translated_characters].
11297    ///
11298    /// # Example
11299    /// ```ignore,no_run
11300    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11301    /// let x = BatchTranslateDocumentMetadata::new().set_translated_characters(42);
11302    /// ```
11303    pub fn set_translated_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11304        self.translated_characters = v.into();
11305        self
11306    }
11307
11308    /// Sets the value of [failed_characters][crate::model::BatchTranslateDocumentMetadata::failed_characters].
11309    ///
11310    /// # Example
11311    /// ```ignore,no_run
11312    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11313    /// let x = BatchTranslateDocumentMetadata::new().set_failed_characters(42);
11314    /// ```
11315    pub fn set_failed_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11316        self.failed_characters = v.into();
11317        self
11318    }
11319
11320    /// Sets the value of [total_billable_characters][crate::model::BatchTranslateDocumentMetadata::total_billable_characters].
11321    ///
11322    /// # Example
11323    /// ```ignore,no_run
11324    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11325    /// let x = BatchTranslateDocumentMetadata::new().set_total_billable_characters(42);
11326    /// ```
11327    pub fn set_total_billable_characters<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11328        self.total_billable_characters = v.into();
11329        self
11330    }
11331
11332    /// Sets the value of [submit_time][crate::model::BatchTranslateDocumentMetadata::submit_time].
11333    ///
11334    /// # Example
11335    /// ```ignore,no_run
11336    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11337    /// use wkt::Timestamp;
11338    /// let x = BatchTranslateDocumentMetadata::new().set_submit_time(Timestamp::default()/* use setters */);
11339    /// ```
11340    pub fn set_submit_time<T>(mut self, v: T) -> Self
11341    where
11342        T: std::convert::Into<wkt::Timestamp>,
11343    {
11344        self.submit_time = std::option::Option::Some(v.into());
11345        self
11346    }
11347
11348    /// Sets or clears the value of [submit_time][crate::model::BatchTranslateDocumentMetadata::submit_time].
11349    ///
11350    /// # Example
11351    /// ```ignore,no_run
11352    /// # use google_cloud_translation_v3::model::BatchTranslateDocumentMetadata;
11353    /// use wkt::Timestamp;
11354    /// let x = BatchTranslateDocumentMetadata::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
11355    /// let x = BatchTranslateDocumentMetadata::new().set_or_clear_submit_time(None::<Timestamp>);
11356    /// ```
11357    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
11358    where
11359        T: std::convert::Into<wkt::Timestamp>,
11360    {
11361        self.submit_time = v.map(|x| x.into());
11362        self
11363    }
11364}
11365
11366impl wkt::message::Message for BatchTranslateDocumentMetadata {
11367    fn typename() -> &'static str {
11368        "type.googleapis.com/google.cloud.translation.v3.BatchTranslateDocumentMetadata"
11369    }
11370}
11371
11372/// Defines additional types related to [BatchTranslateDocumentMetadata].
11373pub mod batch_translate_document_metadata {
11374    #[allow(unused_imports)]
11375    use super::*;
11376
11377    /// State of the job.
11378    ///
11379    /// # Working with unknown values
11380    ///
11381    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11382    /// additional enum variants at any time. Adding new variants is not considered
11383    /// a breaking change. Applications should write their code in anticipation of:
11384    ///
11385    /// - New values appearing in future releases of the client library, **and**
11386    /// - New values received dynamically, without application changes.
11387    ///
11388    /// Please consult the [Working with enums] section in the user guide for some
11389    /// guidelines.
11390    ///
11391    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11392    #[derive(Clone, Debug, PartialEq)]
11393    #[non_exhaustive]
11394    pub enum State {
11395        /// Invalid.
11396        Unspecified,
11397        /// Request is being processed.
11398        Running,
11399        /// The batch is processed, and at least one item was successfully processed.
11400        Succeeded,
11401        /// The batch is done and no item was successfully processed.
11402        Failed,
11403        /// Request is in the process of being canceled after caller invoked
11404        /// longrunning.Operations.CancelOperation on the request id.
11405        Cancelling,
11406        /// The batch is done after the user has called the
11407        /// longrunning.Operations.CancelOperation. Any records processed before the
11408        /// cancel command are output as specified in the request.
11409        Cancelled,
11410        /// If set, the enum was initialized with an unknown value.
11411        ///
11412        /// Applications can examine the value using [State::value] or
11413        /// [State::name].
11414        UnknownValue(state::UnknownValue),
11415    }
11416
11417    #[doc(hidden)]
11418    pub mod state {
11419        #[allow(unused_imports)]
11420        use super::*;
11421        #[derive(Clone, Debug, PartialEq)]
11422        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11423    }
11424
11425    impl State {
11426        /// Gets the enum value.
11427        ///
11428        /// Returns `None` if the enum contains an unknown value deserialized from
11429        /// the string representation of enums.
11430        pub fn value(&self) -> std::option::Option<i32> {
11431            match self {
11432                Self::Unspecified => std::option::Option::Some(0),
11433                Self::Running => std::option::Option::Some(1),
11434                Self::Succeeded => std::option::Option::Some(2),
11435                Self::Failed => std::option::Option::Some(3),
11436                Self::Cancelling => std::option::Option::Some(4),
11437                Self::Cancelled => std::option::Option::Some(5),
11438                Self::UnknownValue(u) => u.0.value(),
11439            }
11440        }
11441
11442        /// Gets the enum value as a string.
11443        ///
11444        /// Returns `None` if the enum contains an unknown value deserialized from
11445        /// the integer representation of enums.
11446        pub fn name(&self) -> std::option::Option<&str> {
11447            match self {
11448                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11449                Self::Running => std::option::Option::Some("RUNNING"),
11450                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
11451                Self::Failed => std::option::Option::Some("FAILED"),
11452                Self::Cancelling => std::option::Option::Some("CANCELLING"),
11453                Self::Cancelled => std::option::Option::Some("CANCELLED"),
11454                Self::UnknownValue(u) => u.0.name(),
11455            }
11456        }
11457    }
11458
11459    impl std::default::Default for State {
11460        fn default() -> Self {
11461            use std::convert::From;
11462            Self::from(0)
11463        }
11464    }
11465
11466    impl std::fmt::Display for State {
11467        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11468            wkt::internal::display_enum(f, self.name(), self.value())
11469        }
11470    }
11471
11472    impl std::convert::From<i32> for State {
11473        fn from(value: i32) -> Self {
11474            match value {
11475                0 => Self::Unspecified,
11476                1 => Self::Running,
11477                2 => Self::Succeeded,
11478                3 => Self::Failed,
11479                4 => Self::Cancelling,
11480                5 => Self::Cancelled,
11481                _ => Self::UnknownValue(state::UnknownValue(
11482                    wkt::internal::UnknownEnumValue::Integer(value),
11483                )),
11484            }
11485        }
11486    }
11487
11488    impl std::convert::From<&str> for State {
11489        fn from(value: &str) -> Self {
11490            use std::string::ToString;
11491            match value {
11492                "STATE_UNSPECIFIED" => Self::Unspecified,
11493                "RUNNING" => Self::Running,
11494                "SUCCEEDED" => Self::Succeeded,
11495                "FAILED" => Self::Failed,
11496                "CANCELLING" => Self::Cancelling,
11497                "CANCELLED" => Self::Cancelled,
11498                _ => Self::UnknownValue(state::UnknownValue(
11499                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11500                )),
11501            }
11502        }
11503    }
11504
11505    impl serde::ser::Serialize for State {
11506        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11507        where
11508            S: serde::Serializer,
11509        {
11510            match self {
11511                Self::Unspecified => serializer.serialize_i32(0),
11512                Self::Running => serializer.serialize_i32(1),
11513                Self::Succeeded => serializer.serialize_i32(2),
11514                Self::Failed => serializer.serialize_i32(3),
11515                Self::Cancelling => serializer.serialize_i32(4),
11516                Self::Cancelled => serializer.serialize_i32(5),
11517                Self::UnknownValue(u) => u.0.serialize(serializer),
11518            }
11519        }
11520    }
11521
11522    impl<'de> serde::de::Deserialize<'de> for State {
11523        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11524        where
11525            D: serde::Deserializer<'de>,
11526        {
11527            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11528                ".google.cloud.translation.v3.BatchTranslateDocumentMetadata.State",
11529            ))
11530        }
11531    }
11532}
11533
11534/// Configures which glossary is used for a specific target language and defines
11535/// options for applying that glossary.
11536#[derive(Clone, Default, PartialEq)]
11537#[non_exhaustive]
11538pub struct TranslateTextGlossaryConfig {
11539    /// Required. The `glossary` to be applied for this translation.
11540    ///
11541    /// The format depends on the glossary:
11542    ///
11543    /// - User-provided custom glossary:
11544    ///   `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
11545    pub glossary: std::string::String,
11546
11547    /// Optional. Indicates match is case insensitive. The default value is `false`
11548    /// if missing.
11549    pub ignore_case: bool,
11550
11551    /// Optional. If set to true, the glossary will be used for contextual
11552    /// translation.
11553    pub contextual_translation_enabled: bool,
11554
11555    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11556}
11557
11558impl TranslateTextGlossaryConfig {
11559    pub fn new() -> Self {
11560        std::default::Default::default()
11561    }
11562
11563    /// Sets the value of [glossary][crate::model::TranslateTextGlossaryConfig::glossary].
11564    ///
11565    /// # Example
11566    /// ```ignore,no_run
11567    /// # use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
11568    /// let x = TranslateTextGlossaryConfig::new().set_glossary("example");
11569    /// ```
11570    pub fn set_glossary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11571        self.glossary = v.into();
11572        self
11573    }
11574
11575    /// Sets the value of [ignore_case][crate::model::TranslateTextGlossaryConfig::ignore_case].
11576    ///
11577    /// # Example
11578    /// ```ignore,no_run
11579    /// # use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
11580    /// let x = TranslateTextGlossaryConfig::new().set_ignore_case(true);
11581    /// ```
11582    pub fn set_ignore_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11583        self.ignore_case = v.into();
11584        self
11585    }
11586
11587    /// Sets the value of [contextual_translation_enabled][crate::model::TranslateTextGlossaryConfig::contextual_translation_enabled].
11588    ///
11589    /// # Example
11590    /// ```ignore,no_run
11591    /// # use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
11592    /// let x = TranslateTextGlossaryConfig::new().set_contextual_translation_enabled(true);
11593    /// ```
11594    pub fn set_contextual_translation_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11595        self.contextual_translation_enabled = v.into();
11596        self
11597    }
11598}
11599
11600impl wkt::message::Message for TranslateTextGlossaryConfig {
11601    fn typename() -> &'static str {
11602        "type.googleapis.com/google.cloud.translation.v3.TranslateTextGlossaryConfig"
11603    }
11604}
11605
11606/// Possible states of long running operations.
11607///
11608/// # Working with unknown values
11609///
11610/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11611/// additional enum variants at any time. Adding new variants is not considered
11612/// a breaking change. Applications should write their code in anticipation of:
11613///
11614/// - New values appearing in future releases of the client library, **and**
11615/// - New values received dynamically, without application changes.
11616///
11617/// Please consult the [Working with enums] section in the user guide for some
11618/// guidelines.
11619///
11620/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11621#[derive(Clone, Debug, PartialEq)]
11622#[non_exhaustive]
11623pub enum OperationState {
11624    /// Invalid.
11625    Unspecified,
11626    /// Request is being processed.
11627    Running,
11628    /// The operation was successful.
11629    Succeeded,
11630    /// Failed to process operation.
11631    Failed,
11632    /// Request is in the process of being canceled after caller invoked
11633    /// longrunning.Operations.CancelOperation on the request id.
11634    Cancelling,
11635    /// The operation request was successfully canceled.
11636    Cancelled,
11637    /// If set, the enum was initialized with an unknown value.
11638    ///
11639    /// Applications can examine the value using [OperationState::value] or
11640    /// [OperationState::name].
11641    UnknownValue(operation_state::UnknownValue),
11642}
11643
11644#[doc(hidden)]
11645pub mod operation_state {
11646    #[allow(unused_imports)]
11647    use super::*;
11648    #[derive(Clone, Debug, PartialEq)]
11649    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11650}
11651
11652impl OperationState {
11653    /// Gets the enum value.
11654    ///
11655    /// Returns `None` if the enum contains an unknown value deserialized from
11656    /// the string representation of enums.
11657    pub fn value(&self) -> std::option::Option<i32> {
11658        match self {
11659            Self::Unspecified => std::option::Option::Some(0),
11660            Self::Running => std::option::Option::Some(1),
11661            Self::Succeeded => std::option::Option::Some(2),
11662            Self::Failed => std::option::Option::Some(3),
11663            Self::Cancelling => std::option::Option::Some(4),
11664            Self::Cancelled => std::option::Option::Some(5),
11665            Self::UnknownValue(u) => u.0.value(),
11666        }
11667    }
11668
11669    /// Gets the enum value as a string.
11670    ///
11671    /// Returns `None` if the enum contains an unknown value deserialized from
11672    /// the integer representation of enums.
11673    pub fn name(&self) -> std::option::Option<&str> {
11674        match self {
11675            Self::Unspecified => std::option::Option::Some("OPERATION_STATE_UNSPECIFIED"),
11676            Self::Running => std::option::Option::Some("OPERATION_STATE_RUNNING"),
11677            Self::Succeeded => std::option::Option::Some("OPERATION_STATE_SUCCEEDED"),
11678            Self::Failed => std::option::Option::Some("OPERATION_STATE_FAILED"),
11679            Self::Cancelling => std::option::Option::Some("OPERATION_STATE_CANCELLING"),
11680            Self::Cancelled => std::option::Option::Some("OPERATION_STATE_CANCELLED"),
11681            Self::UnknownValue(u) => u.0.name(),
11682        }
11683    }
11684}
11685
11686impl std::default::Default for OperationState {
11687    fn default() -> Self {
11688        use std::convert::From;
11689        Self::from(0)
11690    }
11691}
11692
11693impl std::fmt::Display for OperationState {
11694    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11695        wkt::internal::display_enum(f, self.name(), self.value())
11696    }
11697}
11698
11699impl std::convert::From<i32> for OperationState {
11700    fn from(value: i32) -> Self {
11701        match value {
11702            0 => Self::Unspecified,
11703            1 => Self::Running,
11704            2 => Self::Succeeded,
11705            3 => Self::Failed,
11706            4 => Self::Cancelling,
11707            5 => Self::Cancelled,
11708            _ => Self::UnknownValue(operation_state::UnknownValue(
11709                wkt::internal::UnknownEnumValue::Integer(value),
11710            )),
11711        }
11712    }
11713}
11714
11715impl std::convert::From<&str> for OperationState {
11716    fn from(value: &str) -> Self {
11717        use std::string::ToString;
11718        match value {
11719            "OPERATION_STATE_UNSPECIFIED" => Self::Unspecified,
11720            "OPERATION_STATE_RUNNING" => Self::Running,
11721            "OPERATION_STATE_SUCCEEDED" => Self::Succeeded,
11722            "OPERATION_STATE_FAILED" => Self::Failed,
11723            "OPERATION_STATE_CANCELLING" => Self::Cancelling,
11724            "OPERATION_STATE_CANCELLED" => Self::Cancelled,
11725            _ => Self::UnknownValue(operation_state::UnknownValue(
11726                wkt::internal::UnknownEnumValue::String(value.to_string()),
11727            )),
11728        }
11729    }
11730}
11731
11732impl serde::ser::Serialize for OperationState {
11733    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11734    where
11735        S: serde::Serializer,
11736    {
11737        match self {
11738            Self::Unspecified => serializer.serialize_i32(0),
11739            Self::Running => serializer.serialize_i32(1),
11740            Self::Succeeded => serializer.serialize_i32(2),
11741            Self::Failed => serializer.serialize_i32(3),
11742            Self::Cancelling => serializer.serialize_i32(4),
11743            Self::Cancelled => serializer.serialize_i32(5),
11744            Self::UnknownValue(u) => u.0.serialize(serializer),
11745        }
11746    }
11747}
11748
11749impl<'de> serde::de::Deserialize<'de> for OperationState {
11750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11751    where
11752        D: serde::Deserializer<'de>,
11753    {
11754        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationState>::new(
11755            ".google.cloud.translation.v3.OperationState",
11756        ))
11757    }
11758}