#[non_exhaustive]pub struct BatchTranslateTextRequest {
pub parent: String,
pub source_language_code: String,
pub target_language_codes: Vec<String>,
pub models: HashMap<String, String>,
pub input_configs: Vec<InputConfig>,
pub output_config: Option<OutputConfig>,
pub glossaries: HashMap<String, TranslateTextGlossaryConfig>,
pub labels: HashMap<String, String>,
/* private fields */
}Expand description
The batch translation request.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.parent: StringRequired. Location to make a call. Must refer to a caller’s project.
Format: projects/{project-number-or-id}/locations/{location-id}.
The global location is not supported for batch translation.
Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
source_language_code: StringRequired. Source language code. Supported language codes are listed in Language Support.
target_language_codes: Vec<String>Required. Specify up to 10 language codes here. Supported language codes are listed in Language Support.
models: HashMap<String, String>Optional. The models to use for translation. Map’s key is target language code. Map’s value is model name. Value can be a built-in general model, or an AutoML Translation model.
The value format depends on model type:
-
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id} -
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt,
If the map is empty or a specific model is not requested for a language pair, then default google model (nmt) is used.
input_configs: Vec<InputConfig>Required. Input configurations. The total number of files matched should be <= 100. The total content size should be <= 100M Unicode codepoints. The files must use UTF-8 encoding.
output_config: Option<OutputConfig>Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don’t generate output for duplicate inputs.
glossaries: HashMap<String, TranslateTextGlossaryConfig>Optional. Glossaries to be applied for translation. It’s keyed by target language code.
labels: HashMap<String, String>Optional. The labels with user-defined metadata for the request.
Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
See https://cloud.google.com/translate/docs/advanced/labels for more information.
Implementations§
Source§impl BatchTranslateTextRequest
impl BatchTranslateTextRequest
pub fn new() -> Self
Sourcepub fn set_parent<T: Into<String>>(self, v: T) -> Self
pub fn set_parent<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_source_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_source_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of source_language_code.
§Example
let x = BatchTranslateTextRequest::new().set_source_language_code("example");Sourcepub fn set_target_language_codes<T, V>(self, v: T) -> Self
pub fn set_target_language_codes<T, V>(self, v: T) -> Self
Sets the value of target_language_codes.
§Example
let x = BatchTranslateTextRequest::new().set_target_language_codes(["a", "b", "c"]);Sourcepub fn set_models<T, K, V>(self, v: T) -> Self
pub fn set_models<T, K, V>(self, v: T) -> Self
Sourcepub fn set_input_configs<T, V>(self, v: T) -> Self
pub fn set_input_configs<T, V>(self, v: T) -> Self
Sets the value of input_configs.
§Example
use google_cloud_translation_v3::model::InputConfig;
let x = BatchTranslateTextRequest::new()
.set_input_configs([
InputConfig::default()/* use setters */,
InputConfig::default()/* use (different) setters */,
]);Sourcepub fn set_output_config<T>(self, v: T) -> Selfwhere
T: Into<OutputConfig>,
pub fn set_output_config<T>(self, v: T) -> Selfwhere
T: Into<OutputConfig>,
Sets the value of output_config.
§Example
use google_cloud_translation_v3::model::OutputConfig;
let x = BatchTranslateTextRequest::new().set_output_config(OutputConfig::default()/* use setters */);Sourcepub fn set_or_clear_output_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<OutputConfig>,
pub fn set_or_clear_output_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<OutputConfig>,
Sets or clears the value of output_config.
§Example
use google_cloud_translation_v3::model::OutputConfig;
let x = BatchTranslateTextRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
let x = BatchTranslateTextRequest::new().set_or_clear_output_config(None::<OutputConfig>);Sourcepub fn set_glossaries<T, K, V>(self, v: T) -> Self
pub fn set_glossaries<T, K, V>(self, v: T) -> Self
Sets the value of glossaries.
§Example
use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
let x = BatchTranslateTextRequest::new().set_glossaries([
("key0", TranslateTextGlossaryConfig::default()/* use setters */),
("key1", TranslateTextGlossaryConfig::default()/* use (different) setters */),
]);Trait Implementations§
Source§impl Clone for BatchTranslateTextRequest
impl Clone for BatchTranslateTextRequest
Source§fn clone(&self) -> BatchTranslateTextRequest
fn clone(&self) -> BatchTranslateTextRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more