#[non_exhaustive]pub struct TranslateDocumentRequest {
pub parent: String,
pub source_language_code: String,
pub target_language_code: String,
pub document_input_config: Option<DocumentInputConfig>,
pub document_output_config: Option<DocumentOutputConfig>,
pub model: String,
pub glossary_config: Option<TranslateTextGlossaryConfig>,
pub labels: HashMap<String, String>,
pub customized_attribution: String,
pub is_translate_native_pdf_only: bool,
pub enable_shadow_removal_native_pdf: bool,
pub enable_rotation_correction: bool,
/* private fields */
}Expand description
A document 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 regional call.
Format: projects/{project-number-or-id}/locations/{location-id}.
For global calls, use projects/{project-number-or-id}/locations/global or
projects/{project-number-or-id}.
Non-global location is required for requests using AutoML models or custom glossaries.
Models and glossaries must be within the same region (have the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
source_language_code: StringOptional. The ISO-639 language code of the input document if known, for example, “en-US” or “sr-Latn”. Supported language codes are listed in Language Support. If the source language isn’t specified, the API attempts to identify the source language automatically and returns the source language within the response. Source language must be specified if the request contains a glossary or a custom model.
target_language_code: StringRequired. The ISO-639 language code to use for translation of the input document, set to one of the language codes listed in Language Support.
document_input_config: Option<DocumentInputConfig>Required. Input configurations.
document_output_config: Option<DocumentOutputConfig>Optional. Output configurations. Defines if the output file should be stored within Cloud Storage as well as the desired output format. If not provided the translated file will only be returned through a byte-stream and its output mime type will be the same as the input file’s mime type.
model: StringOptional. The model type requested for this translation.
The 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 not provided, the default Google model (NMT) will be used for translation.
glossary_config: Option<TranslateTextGlossaryConfig>Optional. Glossary to be applied. The glossary must be within the same region (have the same location-id) as the model, otherwise an INVALID_ARGUMENT (400) error is returned.
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.
customized_attribution: StringOptional. This flag is to support user customized attribution.
If not provided, the default is Machine Translated by Google.
Customized attribution should follow rules in
https://cloud.google.com/translate/attribution#attribution_and_logos
is_translate_native_pdf_only: boolOptional. is_translate_native_pdf_only field for external customers. If true, the page limit of online native pdf translation is 300 and only native pdf pages will be translated.
enable_shadow_removal_native_pdf: boolOptional. If true, use the text removal server to remove the shadow text on background image for native pdf translation. Shadow removal feature can only be enabled when is_translate_native_pdf_only: false && pdf_native_only: false
enable_rotation_correction: boolOptional. If true, enable auto rotation correction in DVS.
Implementations§
Source§impl TranslateDocumentRequest
impl TranslateDocumentRequest
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 = TranslateDocumentRequest::new().set_source_language_code("example");Sourcepub fn set_target_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_target_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of target_language_code.
§Example
let x = TranslateDocumentRequest::new().set_target_language_code("example");Sourcepub fn set_document_input_config<T>(self, v: T) -> Selfwhere
T: Into<DocumentInputConfig>,
pub fn set_document_input_config<T>(self, v: T) -> Selfwhere
T: Into<DocumentInputConfig>,
Sets the value of document_input_config.
§Example
use google_cloud_translation_v3::model::DocumentInputConfig;
let x = TranslateDocumentRequest::new().set_document_input_config(DocumentInputConfig::default()/* use setters */);Sourcepub fn set_or_clear_document_input_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentInputConfig>,
pub fn set_or_clear_document_input_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentInputConfig>,
Sets or clears the value of document_input_config.
§Example
use google_cloud_translation_v3::model::DocumentInputConfig;
let x = TranslateDocumentRequest::new().set_or_clear_document_input_config(Some(DocumentInputConfig::default()/* use setters */));
let x = TranslateDocumentRequest::new().set_or_clear_document_input_config(None::<DocumentInputConfig>);Sourcepub fn set_document_output_config<T>(self, v: T) -> Selfwhere
T: Into<DocumentOutputConfig>,
pub fn set_document_output_config<T>(self, v: T) -> Selfwhere
T: Into<DocumentOutputConfig>,
Sets the value of document_output_config.
§Example
use google_cloud_translation_v3::model::DocumentOutputConfig;
let x = TranslateDocumentRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);Sourcepub fn set_or_clear_document_output_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentOutputConfig>,
pub fn set_or_clear_document_output_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentOutputConfig>,
Sets or clears the value of document_output_config.
§Example
use google_cloud_translation_v3::model::DocumentOutputConfig;
let x = TranslateDocumentRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
let x = TranslateDocumentRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);Sourcepub fn set_glossary_config<T>(self, v: T) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
pub fn set_glossary_config<T>(self, v: T) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
Sets the value of glossary_config.
§Example
use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
let x = TranslateDocumentRequest::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);Sourcepub fn set_or_clear_glossary_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
pub fn set_or_clear_glossary_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
Sets or clears the value of glossary_config.
§Example
use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
let x = TranslateDocumentRequest::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
let x = TranslateDocumentRequest::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);Sourcepub fn set_labels<T, K, V>(self, v: T) -> Self
pub fn set_labels<T, K, V>(self, v: T) -> Self
Sourcepub fn set_customized_attribution<T: Into<String>>(self, v: T) -> Self
pub fn set_customized_attribution<T: Into<String>>(self, v: T) -> Self
Sets the value of customized_attribution.
§Example
let x = TranslateDocumentRequest::new().set_customized_attribution("example");Sourcepub fn set_is_translate_native_pdf_only<T: Into<bool>>(self, v: T) -> Self
pub fn set_is_translate_native_pdf_only<T: Into<bool>>(self, v: T) -> Self
Sets the value of is_translate_native_pdf_only.
§Example
let x = TranslateDocumentRequest::new().set_is_translate_native_pdf_only(true);Sourcepub fn set_enable_shadow_removal_native_pdf<T: Into<bool>>(self, v: T) -> Self
pub fn set_enable_shadow_removal_native_pdf<T: Into<bool>>(self, v: T) -> Self
Sets the value of enable_shadow_removal_native_pdf.
§Example
let x = TranslateDocumentRequest::new().set_enable_shadow_removal_native_pdf(true);Sourcepub fn set_enable_rotation_correction<T: Into<bool>>(self, v: T) -> Self
pub fn set_enable_rotation_correction<T: Into<bool>>(self, v: T) -> Self
Sets the value of enable_rotation_correction.
§Example
let x = TranslateDocumentRequest::new().set_enable_rotation_correction(true);Trait Implementations§
Source§impl Clone for TranslateDocumentRequest
impl Clone for TranslateDocumentRequest
Source§fn clone(&self) -> TranslateDocumentRequest
fn clone(&self) -> TranslateDocumentRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more