From 76c9a13a0bb8b9dadc9f671e649af82f58c943f6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 10 Sep 2021 11:08:11 -0700 Subject: [PATCH] feat: added v3 proto for online/batch document translation and updated v3beta1 proto for format conversion (#719) PiperOrigin-RevId: 393656336 Source-Link: https://github.com/googleapis/googleapis/commit/17d3fb258cc9527ddcf910a72126de3a43fac440 Source-Link: https://github.com/googleapis/googleapis-gen/commit/00ca50bdde80906d6f62314ef4f7630b8cdb6e15 --- .../translate/v3/translation_service.proto | 594 +- .../v3beta1/translation_service.proto | 14 + protos/protos.d.ts | 2751 ++++-- protos/protos.js | 8033 ++++++++++++----- protos/protos.json | 406 +- src/v3/gapic_metadata.json | 20 + src/v3/translation_service_client.ts | 435 +- src/v3/translation_service_client_config.json | 10 + src/v3beta1/translation_service_client.ts | 11 + test/gapic_translation_service_v3.ts | 308 + 10 files changed, 9511 insertions(+), 3071 deletions(-) diff --git a/protos/google/cloud/translate/v3/translation_service.proto b/protos/google/cloud/translate/v3/translation_service.proto index 3e939a5d..070786ce 100644 --- a/protos/google/cloud/translate/v3/translation_service.proto +++ b/protos/google/cloud/translate/v3/translation_service.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -22,7 +21,9 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Translate.V3"; @@ -81,6 +82,15 @@ service TranslationService { option (google.api.method_signature) = "parent,model,display_language_code"; } + // Translates documents in synchronous mode. + rpc TranslateDocument(TranslateDocumentRequest) + returns (TranslateDocumentResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:translateDocument" + body: "*" + }; + } + // Translates a large volume of text in asynchronous batch mode. // This function provides real-time output as the inputs are being processed. // If caller cancels a request, the partial results (for an input file, it's @@ -100,6 +110,25 @@ service TranslationService { }; } + // Translates a large volume of document in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can use + // google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateDocument(BatchTranslateDocumentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:batchTranslateDocument" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateDocumentResponse" + metadata_type: "BatchTranslateDocumentMetadata" + }; + } + // Creates a glossary and returns the long-running operation. Returns // NOT_FOUND, if the project doesn't exist. rpc CreateGlossary(CreateGlossaryRequest) @@ -152,8 +181,12 @@ service TranslationService { // Configures which glossary should be used for a specific target language, // and defines options for applying that glossary. message TranslateTextGlossaryConfig { - // Required. Specifies the glossary used for this translation. Use - // this format: projects/*/locations/*/glossaries/* + // Required. The `glossary` to be applied for this translation. + // + // The format depends on glossary: + // + // - User provided custom glossary: + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` string glossary = 1 [(google.api.field_behavior) = REQUIRED]; // Optional. Indicates match is case-insensitive. @@ -164,7 +197,8 @@ message TranslateTextGlossaryConfig { // The request message for synchronous translation. message TranslateTextRequest { // Required. The content of the input in string format. - // We recommend the total content be less than 30k codepoints. + // We recommend the total content be less than 30k codepoints. The max length + // of this field is 1024. // Use BatchTranslateText for larger text. repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; @@ -213,14 +247,13 @@ message TranslateTextRequest { // // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` // // // For global (non-regionalized) requests, use `location-id` `global`. // For example, // `projects/{project-number-or-id}/locations/global/models/general/nmt`. // - // If missing, the system decides which google base model to use. + // If not provided, the default Google model (NMT) will be used. string model = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Glossary to be applied. The glossary must be @@ -236,7 +269,8 @@ message TranslateTextRequest { // 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/labels for more information. + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. map labels = 10 [(google.api.field_behavior) = OPTIONAL]; } @@ -257,6 +291,8 @@ message TranslateTextResponse { // A single translation response. message Translation { // Text translated into the target language. + // If an error occurs during translation, this field might be excluded from + // the response. string translated_text = 1; // Only present when `model` is present in the request. @@ -327,7 +363,8 @@ message DetectLanguageRequest { // 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/labels for more information. + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. map labels = 6 [(google.api.field_behavior) = OPTIONAL]; } @@ -343,8 +380,8 @@ message DetectedLanguage { // The response message for language detection. message DetectLanguageResponse { - // A list of detected languages sorted by detection confidence in descending - // order. The most probable language first. + // The most probable language detected by the Translation API. For each + // request, the Translation API will always return only one result. repeated DetectedLanguage languages = 1; } @@ -384,11 +421,10 @@ message GetSupportedLanguagesRequest { // // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` // // // Returns languages supported by the specified model. - // If missing, we get supported languages of Google general base (PBMT) model. + // If missing, we get supported languages of Google general NMT model. string model = 2 [(google.api.field_behavior) = OPTIONAL]; } @@ -422,7 +458,7 @@ message SupportedLanguage { // The Google Cloud Storage location for the input content. message GcsSource { // Required. Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1; + string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; } // Input configuration for BatchTranslateText request. @@ -459,10 +495,12 @@ message InputConfig { // The Google Cloud Storage location for the output content. message GcsDestination { - // Required. There must be no files under 'output_uri_prefix'. - // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an - // INVALID_ARGUMENT (400) error is returned. - string output_uri_prefix = 1; + // Required. The bucket used in 'output_uri_prefix' must exist and there must + // be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + // "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + // batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + // is returned. + string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; } // Output configuration for BatchTranslateText request. @@ -501,8 +539,13 @@ message OutputConfig { // processed and ready to be consumed (that is, no partial output file is // written). // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // // The format of translations_file (for target language code 'trg') is: - // `gs://translation_test/a_b_c_'trg'_translations.[extension]` + // gs://translation_test/a_b_c_'trg'_translations.[extension] // // If the input file extension is tsv, the output has the following // columns: @@ -519,10 +562,10 @@ message OutputConfig { // If input file extension is a txt or html, the translation is directly // written to the output file. If glossary is requested, a separate // glossary_translations_file has format of - // `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` + // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] // // The format of errors file (for target language code 'trg') is: - // `gs://translation_test/a_b_c_'trg'_errors.[extension]` + // gs://translation_test/a_b_c_'trg'_errors.[extension] // // If the input file extension is tsv, errors_file contains the following: // Column 1: ID of the request provided in the input, if it's not @@ -534,11 +577,224 @@ message OutputConfig { // // If the input file extension is txt or html, glossary_error_file will be // generated that contains error details. glossary_error_file has format of - // `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]` + // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] GcsDestination gcs_destination = 1; } } +// A document translation request input config. +message DocumentInputConfig { + // Specifies the source for the document's content. + // The input file size should be <= 20MB for + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // The input file size should be <= 20MB and the maximum page limit is 20 for + // - application/pdf + oneof source { + // Document's content represented as a stream of bytes. + bytes content = 1; + + // Google Cloud Storage location. This must be a single file. + // For example: gs://example_bucket/example_file.pdf + GcsSource gcs_source = 2; + } + + // Specifies the input document's mime_type. + // + // If not specified it will be determined using the file extension for + // gcs_source provided files. For a file provided through bytes content the + // mime_type must be provided. + // Currently supported mime types are: + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 4; +} + +// A document translation request output config. +message DocumentOutputConfig { + // A URI destination for the translated document. + // It is optional to provide a destination. If provided the results from + // TranslateDocument will be stored in the destination. + // Whether a destination is provided or not, the translated documents will be + // returned within TranslateDocumentResponse.document_translation and + // TranslateDocumentResponse.glossary_document_translation. + oneof destination { + // Optional. Google Cloud Storage destination for the translation output, + // e.g., `gs://my_bucket/my_directory/`. + // + // The destination directory provided does not have to be empty, but the + // bucket must exist. If a file with the same name as the output file + // already exists in the destination an error will be returned. + // + // For a DocumentInputConfig.contents provided document, the output file + // will have the name "output_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // For a DocumentInputConfig.gcs_uri provided document, the output file will + // have a name according to its URI. For example: an input file with URI: + // "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + // "my_bucket" will have an output URI: + // "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // If the document was directly provided through the request, then the + // output document will have the format: + // "gs://my_bucket/translated_document_[trg]_translations.[ext], where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // If a glossary was provided, then the output URI for the glossary + // translation will be equal to the default output URI but have + // `glossary_translations` instead of `translations`. For the previous + // example, its glossary URI would be: + // "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + // + // Thus the max number of output files will be 2 (Translated document, + // Glossary translated document). + // + // Callers should expect no partial outputs. If there is any error during + // document translation, no output will be stored in the Cloud Storage + // bucket. + GcsDestination gcs_destination = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Specifies the translated document's mime_type. + // If not specified, the translated file's mime type will be the same as the + // input file's mime type. + // Currently only support the output mime type to be the same as input mime + // type. + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A document translation request. +message TranslateDocumentRequest { + // Required. 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. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The BCP-47 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. + string source_language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // document, set to one of the language codes listed in Language Support. + string target_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + DocumentInputConfig document_input_config = 4 + [(google.api.field_behavior) = REQUIRED]; + + // 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. + DocumentOutputConfig document_output_config = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. 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. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // 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. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A translated document message. +message DocumentTranslation { + // The array of translated documents. It is expected to be size 1 for now. We + // may produce multiple translated documents in the future for other type of + // file formats. + repeated bytes byte_stream_outputs = 1; + + // The translated document's mime type. + string mime_type = 2; + + // The detected language for the input document. + // If the user did not provide the source language for the input document, + // this field will have the language code automatically detected. If the + // source language was passed, auto-detection of the language does not occur + // and this field is empty. + string detected_language_code = 3; +} + +// A translated document response message. +message TranslateDocumentResponse { + // Translated document. + DocumentTranslation document_translation = 1; + + // The document's translation output if a glossary is provided in the request. + // This can be the same as [TranslateDocumentResponse.document_translation] + // if no glossary terms apply. + DocumentTranslation glossary_document_translation = 2; + + // Only present when 'model' is present in the request. + // 'model' is normalized to have a project number. + // + // For example: + // If the 'model' field in TranslateDocumentRequest is: + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 3; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 4; +} + // The batch translation request. message BatchTranslateTextRequest { // Required. Location to make a call. Must refer to a caller's project. @@ -575,7 +831,6 @@ message BatchTranslateTextRequest { // // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` // // // If the map is empty or a specific model is @@ -583,7 +838,7 @@ message BatchTranslateTextRequest { map models = 4 [(google.api.field_behavior) = OPTIONAL]; // Required. Input configurations. - // The total number of files matched should be <= 1000. + // 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. repeated InputConfig input_configs = 5 @@ -606,7 +861,8 @@ message BatchTranslateTextRequest { // 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/labels for more information. + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. map labels = 9 [(google.api.field_behavior) = OPTIONAL]; } @@ -702,9 +958,8 @@ message GlossaryInputConfig { // For equivalent term sets glossaries: // // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - // in multiple languages. The format is defined for Google Translation - // Toolkit and documented in [Use a - // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). + // in multiple languages. See documentation for more information - + // [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). GcsSource gcs_source = 1; } } @@ -737,7 +992,7 @@ message Glossary { // Required. The resource name of the glossary. Glossary names have the form // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - string name = 1; + string name = 1 [(google.api.field_behavior) = REQUIRED]; // Languages supported by the glossary. oneof languages { @@ -821,7 +1076,20 @@ message ListGlossariesRequest { string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Filter specifying constraints of a list operation. - // Filtering is not supported yet, and the parameter currently has no effect. + // Specify the constraint by the format of "key=value", where key must be + // "src" or "tgt", and the value must be a valid language code. + // For multiple restrictions, concatenate them by "AND" (uppercase only), + // such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + // here, which means using 'en-US' and 'en' can lead to different results, + // which depends on the language code you used when you create the glossary. + // For the unidirectional glossaries, the "src" and "tgt" add restrictions + // on the source and target language code separately. + // For the equivalent term set glossaries, the "src" and/or "tgt" add + // restrictions on the term set. + // For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + // glossaries which exactly match the source language code as "en-US" and the + // target language code "zh-CN", but all equivalent term set glossaries which + // contain "en-US" and "zh-CN" in their language set will be picked. // If missing, no filtering is performed. string filter = 4 [(google.api.field_behavior) = OPTIONAL]; } @@ -924,3 +1192,269 @@ message DeleteGlossaryResponse { // set to true. google.protobuf.Timestamp end_time = 3; } + +// The BatchTranslateDocument request. +message BatchTranslateDocumentRequest { + // Required. Location to make a regional call. + // + // 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. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The BCP-47 language code of the input document if known, for + // example, "en-US" or "sr-Latn". Supported language codes are listed in + // Language Support (https://cloud.google.com/translate/docs/languages). + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BCP-47 language code to use for translation of the input + // document. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + // The total number of files matched should be <= 100. + // The total content size to translate should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated BatchDocumentInputConfig input_configs = 4 + [(google.api.field_behavior) = REQUIRED]; + + // 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. + BatchDocumentOutputConfig output_config = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is the 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. + map models = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossaries to be applied. It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. File format conversion map to be applied to all input files. + // Map's key is the original mime_type. Map's value is the target mime_type of + // translated documents. + // + // Supported file format conversion includes: + // - `application/pdf` to + // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + // + // If nothing specified, output files will be in the same format as the + // original file. + map format_conversions = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Input configuration for BatchTranslateDocument request. +message BatchDocumentInputConfig { + // Specify the input. + oneof source { + // Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.docx`) or a wildcard (for example, + // `gs://translation-test/*`). + // + // File mime type is determined based on extension. Supported mime type + // includes: + // - `pdf`, application/pdf + // - `docx`, + // application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - `pptx`, + // application/vnd.openxmlformats-officedocument.presentationml.presentation + // - `xlsx`, + // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // + // The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + // The max file size to support for `.pdf` is 1GB and the max page limit is + // 1000 pages. + // The max file size to support for all input documents is 1GB. + GcsSource gcs_source = 1; + } +} + +// Output configuration for BatchTranslateDocument request. +message BatchDocumentOutputConfig { + // The destination of output. The destination directory provided must exist + // and be empty. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input document (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateDocumentRequest). + // + // While the input documents are being processed, we write/update an index + // file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + // gs://translation_output/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_document,target_language_code,translation_output,error_output, + // glossary_translation_output,glossary_error_output + // + // `input_document` is one file we matched using gcs_source.input_uri. + // `target_language_code` is provided in the request. + // `translation_output` contains the translations. (details provided below) + // `error_output` contains the error message during processing of the file. + // Both translations_file and errors_file could be empty strings if we have + // no content to output. + // `glossary_translation_output` and `glossary_error_output` are the + // translated output/error when we apply glossaries. They could also be + // empty if we have no content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // + // The naming format of translation output files follows (for target + // language code [trg]): `translation_output`: + // gs://translation_output/a_b_c_[trg]_translation.[extension] + // `glossary_translation_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + // output document will maintain the same file format as the input document. + // + // The naming format of error output files follows (for target language code + // [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + // `glossary_error_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + // output is a txt file containing error details. + GcsDestination gcs_destination = 1; + } +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateDocument if at least one document is +// translated successfully. +message BatchTranslateDocumentResponse { + // Total number of pages to translate in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 total_pages = 1; + + // Number of successfully translated pages in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 translated_pages = 2; + + // Number of pages that failed to process in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 failed_pages = 3; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) + int64 total_billable_pages = 4; + + // Total number of characters (Unicode codepoints) in all documents. + int64 total_characters = 5; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents. + int64 translated_characters = 6; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents. + int64 failed_characters = 7; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition, such as XLSX. + int64 total_billable_characters = 8; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 9; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 10; +} + +// State metadata for the batch translation operation. +message BatchTranslateDocumentMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Total number of pages to translate in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 total_pages = 2; + + // Number of successfully translated pages in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 translated_pages = 3; + + // Number of pages that failed to process in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 failed_pages = 4; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) so far. + int64 total_billable_pages = 5; + + // Total number of characters (Unicode codepoints) in all documents so far. + int64 total_characters = 6; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents so far. + int64 translated_characters = 7; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents so far. + int64 failed_characters = 8; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition (such as XLSX) so far. + int64 total_billable_characters = 9; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 10; +} diff --git a/protos/google/cloud/translate/v3beta1/translation_service.proto b/protos/google/cloud/translate/v3beta1/translation_service.proto index 878af796..03386518 100644 --- a/protos/google/cloud/translate/v3beta1/translation_service.proto +++ b/protos/google/cloud/translate/v3beta1/translation_service.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Translate.V3Beta1"; @@ -1241,6 +1242,19 @@ message BatchTranslateDocumentRequest { // Optional. Glossaries to be applied. It's keyed by target language code. map glossaries = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. File format conversion map to be applied to all input files. + // Map's key is the original mime_type. Map's value is the target mime_type of + // translated documents. + // + // Supported file format conversion includes: + // - `application/pdf` to + // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + // + // If nothing specified, output files will be in the same format as the + // original file. + map format_conversions = 8 + [(google.api.field_behavior) = OPTIONAL]; } // Input configuration for BatchTranslateDocument request. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 81abb38d..da1115d1 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -88,6 +88,20 @@ export namespace google { */ public getSupportedLanguages(request: google.cloud.translation.v3.IGetSupportedLanguagesRequest): Promise; + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TranslateDocumentResponse + */ + public translateDocument(request: google.cloud.translation.v3.ITranslateDocumentRequest, callback: google.cloud.translation.v3.TranslationService.TranslateDocumentCallback): void; + + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @returns Promise + */ + public translateDocument(request: google.cloud.translation.v3.ITranslateDocumentRequest): Promise; + /** * Calls BatchTranslateText. * @param request BatchTranslateTextRequest message or plain object @@ -102,6 +116,20 @@ export namespace google { */ public batchTranslateText(request: google.cloud.translation.v3.IBatchTranslateTextRequest): Promise; + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchTranslateDocument(request: google.cloud.translation.v3.IBatchTranslateDocumentRequest, callback: google.cloud.translation.v3.TranslationService.BatchTranslateDocumentCallback): void; + + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @returns Promise + */ + public batchTranslateDocument(request: google.cloud.translation.v3.IBatchTranslateDocumentRequest): Promise; + /** * Calls CreateGlossary. * @param request CreateGlossaryRequest message or plain object @@ -182,6 +210,13 @@ export namespace google { */ type GetSupportedLanguagesCallback = (error: (Error|null), response?: google.cloud.translation.v3.SupportedLanguages) => void; + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService#translateDocument}. + * @param error Error, if any + * @param [response] TranslateDocumentResponse + */ + type TranslateDocumentCallback = (error: (Error|null), response?: google.cloud.translation.v3.TranslateDocumentResponse) => void; + /** * Callback as used by {@link google.cloud.translation.v3.TranslationService#batchTranslateText}. * @param error Error, if any @@ -189,6 +224,13 @@ export namespace google { */ type BatchTranslateTextCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService#batchTranslateDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchTranslateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.translation.v3.TranslationService#createGlossary}. * @param error Error, if any @@ -1625,1601 +1667,2766 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** Properties of a BatchTranslateTextRequest. */ - interface IBatchTranslateTextRequest { - - /** BatchTranslateTextRequest parent */ - parent?: (string|null); - - /** BatchTranslateTextRequest sourceLanguageCode */ - sourceLanguageCode?: (string|null); - - /** BatchTranslateTextRequest targetLanguageCodes */ - targetLanguageCodes?: (string[]|null); - - /** BatchTranslateTextRequest models */ - models?: ({ [k: string]: string }|null); - - /** BatchTranslateTextRequest inputConfigs */ - inputConfigs?: (google.cloud.translation.v3.IInputConfig[]|null); + /** Properties of a DocumentInputConfig. */ + interface IDocumentInputConfig { - /** BatchTranslateTextRequest outputConfig */ - outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); + /** DocumentInputConfig content */ + content?: (Uint8Array|string|null); - /** BatchTranslateTextRequest glossaries */ - glossaries?: ({ [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }|null); + /** DocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); - /** BatchTranslateTextRequest labels */ - labels?: ({ [k: string]: string }|null); + /** DocumentInputConfig mimeType */ + mimeType?: (string|null); } - /** Represents a BatchTranslateTextRequest. */ - class BatchTranslateTextRequest implements IBatchTranslateTextRequest { + /** Represents a DocumentInputConfig. */ + class DocumentInputConfig implements IDocumentInputConfig { /** - * Constructs a new BatchTranslateTextRequest. + * Constructs a new DocumentInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest); - - /** BatchTranslateTextRequest parent. */ - public parent: string; - - /** BatchTranslateTextRequest sourceLanguageCode. */ - public sourceLanguageCode: string; - - /** BatchTranslateTextRequest targetLanguageCodes. */ - public targetLanguageCodes: string[]; - - /** BatchTranslateTextRequest models. */ - public models: { [k: string]: string }; + constructor(properties?: google.cloud.translation.v3.IDocumentInputConfig); - /** BatchTranslateTextRequest inputConfigs. */ - public inputConfigs: google.cloud.translation.v3.IInputConfig[]; + /** DocumentInputConfig content. */ + public content?: (Uint8Array|string|null); - /** BatchTranslateTextRequest outputConfig. */ - public outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); + /** DocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); - /** BatchTranslateTextRequest glossaries. */ - public glossaries: { [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }; + /** DocumentInputConfig mimeType. */ + public mimeType: string; - /** BatchTranslateTextRequest labels. */ - public labels: { [k: string]: string }; + /** DocumentInputConfig source. */ + public source?: ("content"|"gcsSource"); /** - * Creates a new BatchTranslateTextRequest instance using the specified properties. + * Creates a new DocumentInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns BatchTranslateTextRequest instance + * @returns DocumentInputConfig instance */ - public static create(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest): google.cloud.translation.v3.BatchTranslateTextRequest; + public static create(properties?: google.cloud.translation.v3.IDocumentInputConfig): google.cloud.translation.v3.DocumentInputConfig; /** - * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. - * @param message BatchTranslateTextRequest message or plain object to encode + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. - * @param message BatchTranslateTextRequest message or plain object to encode + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * Decodes a DocumentInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchTranslateTextRequest + * @returns DocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateTextRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DocumentInputConfig; /** - * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchTranslateTextRequest + * @returns DocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateTextRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DocumentInputConfig; /** - * Verifies a BatchTranslateTextRequest message. + * Verifies a DocumentInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchTranslateTextRequest + * @returns DocumentInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateTextRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DocumentInputConfig; /** - * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. - * @param message BatchTranslateTextRequest + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. + * @param message DocumentInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.BatchTranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.DocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchTranslateTextRequest to JSON. + * Converts this DocumentInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchTranslateMetadata. */ - interface IBatchTranslateMetadata { - - /** BatchTranslateMetadata state */ - state?: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State|null); - - /** BatchTranslateMetadata translatedCharacters */ - translatedCharacters?: (number|Long|string|null); - - /** BatchTranslateMetadata failedCharacters */ - failedCharacters?: (number|Long|string|null); + /** Properties of a DocumentOutputConfig. */ + interface IDocumentOutputConfig { - /** BatchTranslateMetadata totalCharacters */ - totalCharacters?: (number|Long|string|null); + /** DocumentOutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); - /** BatchTranslateMetadata submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); + /** DocumentOutputConfig mimeType */ + mimeType?: (string|null); } - /** Represents a BatchTranslateMetadata. */ - class BatchTranslateMetadata implements IBatchTranslateMetadata { + /** Represents a DocumentOutputConfig. */ + class DocumentOutputConfig implements IDocumentOutputConfig { /** - * Constructs a new BatchTranslateMetadata. + * Constructs a new DocumentOutputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IBatchTranslateMetadata); - - /** BatchTranslateMetadata state. */ - public state: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State); - - /** BatchTranslateMetadata translatedCharacters. */ - public translatedCharacters: (number|Long|string); + constructor(properties?: google.cloud.translation.v3.IDocumentOutputConfig); - /** BatchTranslateMetadata failedCharacters. */ - public failedCharacters: (number|Long|string); + /** DocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); - /** BatchTranslateMetadata totalCharacters. */ - public totalCharacters: (number|Long|string); + /** DocumentOutputConfig mimeType. */ + public mimeType: string; - /** BatchTranslateMetadata submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); + /** DocumentOutputConfig destination. */ + public destination?: "gcsDestination"; /** - * Creates a new BatchTranslateMetadata instance using the specified properties. + * Creates a new DocumentOutputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns BatchTranslateMetadata instance + * @returns DocumentOutputConfig instance */ - public static create(properties?: google.cloud.translation.v3.IBatchTranslateMetadata): google.cloud.translation.v3.BatchTranslateMetadata; + public static create(properties?: google.cloud.translation.v3.IDocumentOutputConfig): google.cloud.translation.v3.DocumentOutputConfig; /** - * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. - * @param message BatchTranslateMetadata message or plain object to encode + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. - * @param message BatchTranslateMetadata message or plain object to encode + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. + * @param message DocumentOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * Decodes a DocumentOutputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchTranslateMetadata + * @returns DocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DocumentOutputConfig; /** - * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchTranslateMetadata + * @returns DocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DocumentOutputConfig; /** - * Verifies a BatchTranslateMetadata message. + * Verifies a DocumentOutputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchTranslateMetadata + * @returns DocumentOutputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DocumentOutputConfig; /** - * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. - * @param message BatchTranslateMetadata + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @param message DocumentOutputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.BatchTranslateMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.DocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchTranslateMetadata to JSON. + * Converts this DocumentOutputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace BatchTranslateMetadata { + /** Properties of a TranslateDocumentRequest. */ + interface ITranslateDocumentRequest { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - SUCCEEDED = 2, - FAILED = 3, - CANCELLING = 4, - CANCELLED = 5 - } - } + /** TranslateDocumentRequest parent */ + parent?: (string|null); - /** Properties of a BatchTranslateResponse. */ - interface IBatchTranslateResponse { + /** TranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); - /** BatchTranslateResponse totalCharacters */ - totalCharacters?: (number|Long|string|null); + /** TranslateDocumentRequest targetLanguageCode */ + targetLanguageCode?: (string|null); - /** BatchTranslateResponse translatedCharacters */ - translatedCharacters?: (number|Long|string|null); + /** TranslateDocumentRequest documentInputConfig */ + documentInputConfig?: (google.cloud.translation.v3.IDocumentInputConfig|null); - /** BatchTranslateResponse failedCharacters */ - failedCharacters?: (number|Long|string|null); + /** TranslateDocumentRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.translation.v3.IDocumentOutputConfig|null); - /** BatchTranslateResponse submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentRequest model */ + model?: (string|null); - /** BatchTranslateResponse endTime */ - endTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentRequest glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels */ + labels?: ({ [k: string]: string }|null); } - /** Represents a BatchTranslateResponse. */ - class BatchTranslateResponse implements IBatchTranslateResponse { + /** Represents a TranslateDocumentRequest. */ + class TranslateDocumentRequest implements ITranslateDocumentRequest { /** - * Constructs a new BatchTranslateResponse. + * Constructs a new TranslateDocumentRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IBatchTranslateResponse); + constructor(properties?: google.cloud.translation.v3.ITranslateDocumentRequest); - /** BatchTranslateResponse totalCharacters. */ - public totalCharacters: (number|Long|string); + /** TranslateDocumentRequest parent. */ + public parent: string; - /** BatchTranslateResponse translatedCharacters. */ - public translatedCharacters: (number|Long|string); + /** TranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; - /** BatchTranslateResponse failedCharacters. */ - public failedCharacters: (number|Long|string); + /** TranslateDocumentRequest targetLanguageCode. */ + public targetLanguageCode: string; - /** BatchTranslateResponse submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentRequest documentInputConfig. */ + public documentInputConfig?: (google.cloud.translation.v3.IDocumentInputConfig|null); - /** BatchTranslateResponse endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.translation.v3.IDocumentOutputConfig|null); + + /** TranslateDocumentRequest model. */ + public model: string; + + /** TranslateDocumentRequest glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels. */ + public labels: { [k: string]: string }; /** - * Creates a new BatchTranslateResponse instance using the specified properties. + * Creates a new TranslateDocumentRequest instance using the specified properties. * @param [properties] Properties to set - * @returns BatchTranslateResponse instance + * @returns TranslateDocumentRequest instance */ - public static create(properties?: google.cloud.translation.v3.IBatchTranslateResponse): google.cloud.translation.v3.BatchTranslateResponse; + public static create(properties?: google.cloud.translation.v3.ITranslateDocumentRequest): google.cloud.translation.v3.TranslateDocumentRequest; /** - * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. - * @param message BatchTranslateResponse message or plain object to encode + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. - * @param message BatchTranslateResponse message or plain object to encode + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchTranslateResponse + * @returns TranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateDocumentRequest; /** - * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchTranslateResponse + * @returns TranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateDocumentRequest; /** - * Verifies a BatchTranslateResponse message. + * Verifies a TranslateDocumentRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchTranslateResponse + * @returns TranslateDocumentRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateDocumentRequest; /** - * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. - * @param message BatchTranslateResponse + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. + * @param message TranslateDocumentRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.BatchTranslateResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.TranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchTranslateResponse to JSON. + * Converts this TranslateDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GlossaryInputConfig. */ - interface IGlossaryInputConfig { + /** Properties of a DocumentTranslation. */ + interface IDocumentTranslation { - /** GlossaryInputConfig gcsSource */ - gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + /** DocumentTranslation byteStreamOutputs */ + byteStreamOutputs?: (Uint8Array[]|null); + + /** DocumentTranslation mimeType */ + mimeType?: (string|null); + + /** DocumentTranslation detectedLanguageCode */ + detectedLanguageCode?: (string|null); } - /** Represents a GlossaryInputConfig. */ - class GlossaryInputConfig implements IGlossaryInputConfig { + /** Represents a DocumentTranslation. */ + class DocumentTranslation implements IDocumentTranslation { /** - * Constructs a new GlossaryInputConfig. + * Constructs a new DocumentTranslation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IGlossaryInputConfig); + constructor(properties?: google.cloud.translation.v3.IDocumentTranslation); - /** GlossaryInputConfig gcsSource. */ - public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + /** DocumentTranslation byteStreamOutputs. */ + public byteStreamOutputs: Uint8Array[]; - /** GlossaryInputConfig source. */ - public source?: "gcsSource"; + /** DocumentTranslation mimeType. */ + public mimeType: string; + + /** DocumentTranslation detectedLanguageCode. */ + public detectedLanguageCode: string; /** - * Creates a new GlossaryInputConfig instance using the specified properties. + * Creates a new DocumentTranslation instance using the specified properties. * @param [properties] Properties to set - * @returns GlossaryInputConfig instance + * @returns DocumentTranslation instance */ - public static create(properties?: google.cloud.translation.v3.IGlossaryInputConfig): google.cloud.translation.v3.GlossaryInputConfig; + public static create(properties?: google.cloud.translation.v3.IDocumentTranslation): google.cloud.translation.v3.DocumentTranslation; /** - * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. - * @param message GlossaryInputConfig message or plain object to encode + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. - * @param message GlossaryInputConfig message or plain object to encode + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * Decodes a DocumentTranslation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GlossaryInputConfig + * @returns DocumentTranslation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GlossaryInputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DocumentTranslation; /** - * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GlossaryInputConfig + * @returns DocumentTranslation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GlossaryInputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DocumentTranslation; /** - * Verifies a GlossaryInputConfig message. + * Verifies a DocumentTranslation message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GlossaryInputConfig + * @returns DocumentTranslation */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GlossaryInputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DocumentTranslation; /** - * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. - * @param message GlossaryInputConfig + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. + * @param message DocumentTranslation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.GlossaryInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.DocumentTranslation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GlossaryInputConfig to JSON. + * Converts this DocumentTranslation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Glossary. */ - interface IGlossary { - - /** Glossary name */ - name?: (string|null); - - /** Glossary languagePair */ - languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); - - /** Glossary languageCodesSet */ - languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + /** Properties of a TranslateDocumentResponse. */ + interface ITranslateDocumentResponse { - /** Glossary inputConfig */ - inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); + /** TranslateDocumentResponse documentTranslation */ + documentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); - /** Glossary entryCount */ - entryCount?: (number|null); + /** TranslateDocumentResponse glossaryDocumentTranslation */ + glossaryDocumentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); - /** Glossary submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentResponse model */ + model?: (string|null); - /** Glossary endTime */ - endTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentResponse glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); } - /** Represents a Glossary. */ - class Glossary implements IGlossary { + /** Represents a TranslateDocumentResponse. */ + class TranslateDocumentResponse implements ITranslateDocumentResponse { /** - * Constructs a new Glossary. + * Constructs a new TranslateDocumentResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IGlossary); - - /** Glossary name. */ - public name: string; - - /** Glossary languagePair. */ - public languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); - - /** Glossary languageCodesSet. */ - public languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + constructor(properties?: google.cloud.translation.v3.ITranslateDocumentResponse); - /** Glossary inputConfig. */ - public inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); - - /** Glossary entryCount. */ - public entryCount: number; + /** TranslateDocumentResponse documentTranslation. */ + public documentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); - /** Glossary submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentResponse glossaryDocumentTranslation. */ + public glossaryDocumentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); - /** Glossary endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** TranslateDocumentResponse model. */ + public model: string; - /** Glossary languages. */ - public languages?: ("languagePair"|"languageCodesSet"); + /** TranslateDocumentResponse glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); /** - * Creates a new Glossary instance using the specified properties. + * Creates a new TranslateDocumentResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Glossary instance + * @returns TranslateDocumentResponse instance */ - public static create(properties?: google.cloud.translation.v3.IGlossary): google.cloud.translation.v3.Glossary; + public static create(properties?: google.cloud.translation.v3.ITranslateDocumentResponse): google.cloud.translation.v3.TranslateDocumentResponse; /** - * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. - * @param message Glossary message or plain object to encode + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. - * @param message Glossary message or plain object to encode + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Glossary message from the specified reader or buffer. + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Glossary + * @returns TranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateDocumentResponse; /** - * Decodes a Glossary message from the specified reader or buffer, length delimited. + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Glossary + * @returns TranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateDocumentResponse; /** - * Verifies a Glossary message. + * Verifies a TranslateDocumentResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Glossary + * @returns TranslateDocumentResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateDocumentResponse; /** - * Creates a plain object from a Glossary message. Also converts values to other types if specified. - * @param message Glossary + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. + * @param message TranslateDocumentResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.Glossary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.TranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Glossary to JSON. + * Converts this TranslateDocumentResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Glossary { + /** Properties of a BatchTranslateTextRequest. */ + interface IBatchTranslateTextRequest { - /** Properties of a LanguageCodePair. */ - interface ILanguageCodePair { + /** BatchTranslateTextRequest parent */ + parent?: (string|null); - /** LanguageCodePair sourceLanguageCode */ - sourceLanguageCode?: (string|null); + /** BatchTranslateTextRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); - /** LanguageCodePair targetLanguageCode */ - targetLanguageCode?: (string|null); - } + /** BatchTranslateTextRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); - /** Represents a LanguageCodePair. */ - class LanguageCodePair implements ILanguageCodePair { + /** BatchTranslateTextRequest models */ + models?: ({ [k: string]: string }|null); - /** - * Constructs a new LanguageCodePair. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair); + /** BatchTranslateTextRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3.IInputConfig[]|null); - /** LanguageCodePair sourceLanguageCode. */ - public sourceLanguageCode: string; + /** BatchTranslateTextRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); - /** LanguageCodePair targetLanguageCode. */ - public targetLanguageCode: string; + /** BatchTranslateTextRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }|null); - /** - * Creates a new LanguageCodePair instance using the specified properties. - * @param [properties] Properties to set - * @returns LanguageCodePair instance - */ - public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair): google.cloud.translation.v3.Glossary.LanguageCodePair; + /** BatchTranslateTextRequest labels */ + labels?: ({ [k: string]: string }|null); + } - /** - * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. - * @param message LanguageCodePair message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + /** Represents a BatchTranslateTextRequest. */ + class BatchTranslateTextRequest implements IBatchTranslateTextRequest { - /** - * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. - * @param message LanguageCodePair message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Constructs a new BatchTranslateTextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest); - /** - * Decodes a LanguageCodePair message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LanguageCodePair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodePair; + /** BatchTranslateTextRequest parent. */ + public parent: string; - /** - * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LanguageCodePair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodePair; + /** BatchTranslateTextRequest sourceLanguageCode. */ + public sourceLanguageCode: string; - /** - * Verifies a LanguageCodePair message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** BatchTranslateTextRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; - /** - * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LanguageCodePair - */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodePair; + /** BatchTranslateTextRequest models. */ + public models: { [k: string]: string }; - /** - * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. - * @param message LanguageCodePair - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodePair, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** BatchTranslateTextRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3.IInputConfig[]; - /** - * Converts this LanguageCodePair to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** BatchTranslateTextRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); - /** Properties of a LanguageCodesSet. */ - interface ILanguageCodesSet { + /** BatchTranslateTextRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }; - /** LanguageCodesSet languageCodes */ - languageCodes?: (string[]|null); - } + /** BatchTranslateTextRequest labels. */ + public labels: { [k: string]: string }; - /** Represents a LanguageCodesSet. */ - class LanguageCodesSet implements ILanguageCodesSet { + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateTextRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest): google.cloud.translation.v3.BatchTranslateTextRequest; - /** - * Constructs a new LanguageCodesSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet); + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** LanguageCodesSet languageCodes. */ - public languageCodes: string[]; + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a new LanguageCodesSet instance using the specified properties. - * @param [properties] Properties to set - * @returns LanguageCodesSet instance - */ - public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet): google.cloud.translation.v3.Glossary.LanguageCodesSet; + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateTextRequest; - /** - * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. - * @param message LanguageCodesSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateTextRequest; - /** - * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. - * @param message LanguageCodesSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Verifies a BatchTranslateTextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Decodes a LanguageCodesSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LanguageCodesSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodesSet; + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateTextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateTextRequest; - /** - * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LanguageCodesSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodesSet; + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @param message BatchTranslateTextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Verifies a LanguageCodesSet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Converts this BatchTranslateTextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** - * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LanguageCodesSet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodesSet; + /** Properties of a BatchTranslateMetadata. */ + interface IBatchTranslateMetadata { + + /** BatchTranslateMetadata state */ + state?: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State|null); + + /** BatchTranslateMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateMetadata. */ + class BatchTranslateMetadata implements IBatchTranslateMetadata { + + /** + * Constructs a new BatchTranslateMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateMetadata); + + /** BatchTranslateMetadata state. */ + public state: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State); + + /** BatchTranslateMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateMetadata instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateMetadata): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Verifies a BatchTranslateMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchTranslateMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a BatchTranslateResponse. */ + interface IBatchTranslateResponse { + + /** BatchTranslateResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateResponse. */ + class BatchTranslateResponse implements IBatchTranslateResponse { + + /** + * Constructs a new BatchTranslateResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateResponse); + + /** BatchTranslateResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateResponse): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Verifies a BatchTranslateResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @param message BatchTranslateResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GlossaryInputConfig. */ + interface IGlossaryInputConfig { + + /** GlossaryInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + } + + /** Represents a GlossaryInputConfig. */ + class GlossaryInputConfig implements IGlossaryInputConfig { + + /** + * Constructs a new GlossaryInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGlossaryInputConfig); + + /** GlossaryInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** GlossaryInputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GlossaryInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IGlossaryInputConfig): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Verifies a GlossaryInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GlossaryInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @param message GlossaryInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.GlossaryInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Glossary. */ + interface IGlossary { + + /** Glossary name */ + name?: (string|null); + + /** Glossary languagePair */ + languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet */ + languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig */ + inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); + + /** Glossary entryCount */ + entryCount?: (number|null); + + /** Glossary submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Glossary. */ + class Glossary implements IGlossary { + + /** + * Constructs a new Glossary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGlossary); + + /** Glossary name. */ + public name: string; + + /** Glossary languagePair. */ + public languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet. */ + public languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig. */ + public inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); + + /** Glossary entryCount. */ + public entryCount: number; + + /** Glossary submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Glossary languages. */ + public languages?: ("languagePair"|"languageCodesSet"); + + /** + * Creates a new Glossary instance using the specified properties. + * @param [properties] Properties to set + * @returns Glossary instance + */ + public static create(properties?: google.cloud.translation.v3.IGlossary): google.cloud.translation.v3.Glossary; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary; + + /** + * Verifies a Glossary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Glossary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @param message Glossary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Glossary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Glossary { + + /** Properties of a LanguageCodePair. */ + interface ILanguageCodePair { + + /** LanguageCodePair sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** LanguageCodePair targetLanguageCode */ + targetLanguageCode?: (string|null); + } + + /** Represents a LanguageCodePair. */ + class LanguageCodePair implements ILanguageCodePair { + + /** + * Constructs a new LanguageCodePair. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair); + + /** LanguageCodePair sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** LanguageCodePair targetLanguageCode. */ + public targetLanguageCode: string; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodePair instance + */ + public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Verifies a LanguageCodePair message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodePair + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @param message LanguageCodePair + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodePair, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodePair to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LanguageCodesSet. */ + interface ILanguageCodesSet { + + /** LanguageCodesSet languageCodes */ + languageCodes?: (string[]|null); + } + + /** Represents a LanguageCodesSet. */ + class LanguageCodesSet implements ILanguageCodesSet { + + /** + * Constructs a new LanguageCodesSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet); + + /** LanguageCodesSet languageCodes. */ + public languageCodes: string[]; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodesSet instance + */ + public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Verifies a LanguageCodesSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodesSet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @param message LanguageCodesSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodesSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodesSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a CreateGlossaryRequest. */ + interface ICreateGlossaryRequest { + + /** CreateGlossaryRequest parent */ + parent?: (string|null); + + /** CreateGlossaryRequest glossary */ + glossary?: (google.cloud.translation.v3.IGlossary|null); + } + + /** Represents a CreateGlossaryRequest. */ + class CreateGlossaryRequest implements ICreateGlossaryRequest { + + /** + * Constructs a new CreateGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ICreateGlossaryRequest); + + /** CreateGlossaryRequest parent. */ + public parent: string; + + /** CreateGlossaryRequest glossary. */ + public glossary?: (google.cloud.translation.v3.IGlossary|null); + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.ICreateGlossaryRequest): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Verifies a CreateGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @param message CreateGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.CreateGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetGlossaryRequest. */ + interface IGetGlossaryRequest { + + /** GetGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a GetGlossaryRequest. */ + class GetGlossaryRequest implements IGetGlossaryRequest { + + /** + * Constructs a new GetGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGetGlossaryRequest); + + /** GetGlossaryRequest name. */ + public name: string; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IGetGlossaryRequest): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Verifies a GetGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @param message GetGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.GetGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteGlossaryRequest. */ + interface IDeleteGlossaryRequest { + + /** DeleteGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a DeleteGlossaryRequest. */ + class DeleteGlossaryRequest implements IDeleteGlossaryRequest { + + /** + * Constructs a new DeleteGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest); + + /** DeleteGlossaryRequest name. */ + public name: string; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Verifies a DeleteGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @param message DeleteGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListGlossariesRequest. */ + interface IListGlossariesRequest { + + /** ListGlossariesRequest parent */ + parent?: (string|null); + + /** ListGlossariesRequest pageSize */ + pageSize?: (number|null); + + /** ListGlossariesRequest pageToken */ + pageToken?: (string|null); + + /** ListGlossariesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListGlossariesRequest. */ + class ListGlossariesRequest implements IListGlossariesRequest { + + /** + * Constructs a new ListGlossariesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IListGlossariesRequest); + + /** ListGlossariesRequest parent. */ + public parent: string; + + /** ListGlossariesRequest pageSize. */ + public pageSize: number; + + /** ListGlossariesRequest pageToken. */ + public pageToken: string; + + /** ListGlossariesRequest filter. */ + public filter: string; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IListGlossariesRequest): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Verifies a ListGlossariesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @param message ListGlossariesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.ListGlossariesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListGlossariesResponse. */ + interface IListGlossariesResponse { + + /** ListGlossariesResponse glossaries */ + glossaries?: (google.cloud.translation.v3.IGlossary[]|null); + + /** ListGlossariesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListGlossariesResponse. */ + class ListGlossariesResponse implements IListGlossariesResponse { + + /** + * Constructs a new ListGlossariesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IListGlossariesResponse); + + /** ListGlossariesResponse glossaries. */ + public glossaries: google.cloud.translation.v3.IGlossary[]; + + /** ListGlossariesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IListGlossariesResponse): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Verifies a ListGlossariesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. - * @param message LanguageCodesSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodesSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesResponse; - /** - * Converts this LanguageCodesSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @param message ListGlossariesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.ListGlossariesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a CreateGlossaryRequest. */ - interface ICreateGlossaryRequest { + /** Properties of a CreateGlossaryMetadata. */ + interface ICreateGlossaryMetadata { - /** CreateGlossaryRequest parent */ - parent?: (string|null); + /** CreateGlossaryMetadata name */ + name?: (string|null); - /** CreateGlossaryRequest glossary */ - glossary?: (google.cloud.translation.v3.IGlossary|null); + /** CreateGlossaryMetadata state */ + state?: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State|null); + + /** CreateGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); } - /** Represents a CreateGlossaryRequest. */ - class CreateGlossaryRequest implements ICreateGlossaryRequest { + /** Represents a CreateGlossaryMetadata. */ + class CreateGlossaryMetadata implements ICreateGlossaryMetadata { /** - * Constructs a new CreateGlossaryRequest. + * Constructs a new CreateGlossaryMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.ICreateGlossaryRequest); + constructor(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata); - /** CreateGlossaryRequest parent. */ - public parent: string; + /** CreateGlossaryMetadata name. */ + public name: string; - /** CreateGlossaryRequest glossary. */ - public glossary?: (google.cloud.translation.v3.IGlossary|null); + /** CreateGlossaryMetadata state. */ + public state: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State); + + /** CreateGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new CreateGlossaryRequest instance using the specified properties. + * Creates a new CreateGlossaryMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns CreateGlossaryRequest instance + * @returns CreateGlossaryMetadata instance */ - public static create(properties?: google.cloud.translation.v3.ICreateGlossaryRequest): google.cloud.translation.v3.CreateGlossaryRequest; + public static create(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata): google.cloud.translation.v3.CreateGlossaryMetadata; /** - * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. - * @param message CreateGlossaryRequest message or plain object to encode + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. - * @param message CreateGlossaryRequest message or plain object to encode + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateGlossaryRequest + * @returns CreateGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryMetadata; /** - * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateGlossaryRequest + * @returns CreateGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryMetadata; /** - * Verifies a CreateGlossaryRequest message. + * Verifies a CreateGlossaryMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateGlossaryRequest + * @returns CreateGlossaryMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryMetadata; /** - * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. - * @param message CreateGlossaryRequest + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * @param message CreateGlossaryMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.CreateGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.CreateGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateGlossaryRequest to JSON. + * Converts this CreateGlossaryMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GetGlossaryRequest. */ - interface IGetGlossaryRequest { + namespace CreateGlossaryMetadata { - /** GetGlossaryRequest name */ + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryMetadata. */ + interface IDeleteGlossaryMetadata { + + /** DeleteGlossaryMetadata name */ name?: (string|null); + + /** DeleteGlossaryMetadata state */ + state?: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State|null); + + /** DeleteGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); } - /** Represents a GetGlossaryRequest. */ - class GetGlossaryRequest implements IGetGlossaryRequest { + /** Represents a DeleteGlossaryMetadata. */ + class DeleteGlossaryMetadata implements IDeleteGlossaryMetadata { /** - * Constructs a new GetGlossaryRequest. + * Constructs a new DeleteGlossaryMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IGetGlossaryRequest); + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata); - /** GetGlossaryRequest name. */ + /** DeleteGlossaryMetadata name. */ public name: string; + /** DeleteGlossaryMetadata state. */ + public state: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State); + + /** DeleteGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + /** - * Creates a new GetGlossaryRequest instance using the specified properties. + * Creates a new DeleteGlossaryMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns GetGlossaryRequest instance + * @returns DeleteGlossaryMetadata instance */ - public static create(properties?: google.cloud.translation.v3.IGetGlossaryRequest): google.cloud.translation.v3.GetGlossaryRequest; + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata): google.cloud.translation.v3.DeleteGlossaryMetadata; /** - * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. - * @param message GetGlossaryRequest message or plain object to encode + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. - * @param message GetGlossaryRequest message or plain object to encode + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetGlossaryRequest + * @returns DeleteGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GetGlossaryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryMetadata; /** - * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetGlossaryRequest + * @returns DeleteGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GetGlossaryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryMetadata; /** - * Verifies a GetGlossaryRequest message. + * Verifies a DeleteGlossaryMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetGlossaryRequest + * @returns DeleteGlossaryMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GetGlossaryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryMetadata; /** - * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. - * @param message GetGlossaryRequest + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * @param message DeleteGlossaryMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.GetGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetGlossaryRequest to JSON. + * Converts this DeleteGlossaryMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteGlossaryRequest. */ - interface IDeleteGlossaryRequest { + namespace DeleteGlossaryMetadata { - /** DeleteGlossaryRequest name */ + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryResponse. */ + interface IDeleteGlossaryResponse { + + /** DeleteGlossaryResponse name */ name?: (string|null); + + /** DeleteGlossaryResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); } - /** Represents a DeleteGlossaryRequest. */ - class DeleteGlossaryRequest implements IDeleteGlossaryRequest { + /** Represents a DeleteGlossaryResponse. */ + class DeleteGlossaryResponse implements IDeleteGlossaryResponse { /** - * Constructs a new DeleteGlossaryRequest. + * Constructs a new DeleteGlossaryResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest); + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse); - /** DeleteGlossaryRequest name. */ + /** DeleteGlossaryResponse name. */ public name: string; + /** DeleteGlossaryResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + /** - * Creates a new DeleteGlossaryRequest instance using the specified properties. + * Creates a new DeleteGlossaryResponse instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteGlossaryRequest instance + * @returns DeleteGlossaryResponse instance */ - public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest): google.cloud.translation.v3.DeleteGlossaryRequest; + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse): google.cloud.translation.v3.DeleteGlossaryResponse; /** - * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. - * @param message DeleteGlossaryRequest message or plain object to encode + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. - * @param message DeleteGlossaryRequest message or plain object to encode + /** + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteGlossaryRequest + * @returns DeleteGlossaryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryResponse; /** - * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteGlossaryRequest + * @returns DeleteGlossaryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryResponse; /** - * Verifies a DeleteGlossaryRequest message. + * Verifies a DeleteGlossaryResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteGlossaryRequest + * @returns DeleteGlossaryResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryResponse; /** - * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. - * @param message DeleteGlossaryRequest + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * @param message DeleteGlossaryResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.DeleteGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteGlossaryRequest to JSON. + * Converts this DeleteGlossaryResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListGlossariesRequest. */ - interface IListGlossariesRequest { + /** Properties of a BatchTranslateDocumentRequest. */ + interface IBatchTranslateDocumentRequest { - /** ListGlossariesRequest parent */ + /** BatchTranslateDocumentRequest parent */ parent?: (string|null); - /** ListGlossariesRequest pageSize */ - pageSize?: (number|null); + /** BatchTranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); - /** ListGlossariesRequest pageToken */ - pageToken?: (string|null); + /** BatchTranslateDocumentRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); - /** ListGlossariesRequest filter */ - filter?: (string|null); + /** BatchTranslateDocumentRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3.IBatchDocumentInputConfig[]|null); + + /** BatchTranslateDocumentRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models */ + models?: ({ [k: string]: string }|null); + + /** BatchTranslateDocumentRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateDocumentRequest formatConversions */ + formatConversions?: ({ [k: string]: string }|null); } - /** Represents a ListGlossariesRequest. */ - class ListGlossariesRequest implements IListGlossariesRequest { + /** Represents a BatchTranslateDocumentRequest. */ + class BatchTranslateDocumentRequest implements IBatchTranslateDocumentRequest { /** - * Constructs a new ListGlossariesRequest. + * Constructs a new BatchTranslateDocumentRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IListGlossariesRequest); + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentRequest); - /** ListGlossariesRequest parent. */ + /** BatchTranslateDocumentRequest parent. */ public parent: string; - /** ListGlossariesRequest pageSize. */ - public pageSize: number; + /** BatchTranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; - /** ListGlossariesRequest pageToken. */ - public pageToken: string; + /** BatchTranslateDocumentRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; - /** ListGlossariesRequest filter. */ - public filter: string; + /** BatchTranslateDocumentRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3.IBatchDocumentInputConfig[]; + + /** BatchTranslateDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models. */ + public models: { [k: string]: string }; + + /** BatchTranslateDocumentRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }; + + /** BatchTranslateDocumentRequest formatConversions. */ + public formatConversions: { [k: string]: string }; /** - * Creates a new ListGlossariesRequest instance using the specified properties. + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListGlossariesRequest instance + * @returns BatchTranslateDocumentRequest instance */ - public static create(properties?: google.cloud.translation.v3.IListGlossariesRequest): google.cloud.translation.v3.ListGlossariesRequest; + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentRequest): google.cloud.translation.v3.BatchTranslateDocumentRequest; /** - * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. - * @param message ListGlossariesRequest message or plain object to encode + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. - * @param message ListGlossariesRequest message or plain object to encode + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListGlossariesRequest + * @returns BatchTranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentRequest; /** - * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListGlossariesRequest + * @returns BatchTranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentRequest; /** - * Verifies a ListGlossariesRequest message. + * Verifies a BatchTranslateDocumentRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListGlossariesRequest + * @returns BatchTranslateDocumentRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentRequest; /** - * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. - * @param message ListGlossariesRequest + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.ListGlossariesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListGlossariesRequest to JSON. + * Converts this BatchTranslateDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListGlossariesResponse. */ - interface IListGlossariesResponse { - - /** ListGlossariesResponse glossaries */ - glossaries?: (google.cloud.translation.v3.IGlossary[]|null); + /** Properties of a BatchDocumentInputConfig. */ + interface IBatchDocumentInputConfig { - /** ListGlossariesResponse nextPageToken */ - nextPageToken?: (string|null); + /** BatchDocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); } - /** Represents a ListGlossariesResponse. */ - class ListGlossariesResponse implements IListGlossariesResponse { + /** Represents a BatchDocumentInputConfig. */ + class BatchDocumentInputConfig implements IBatchDocumentInputConfig { /** - * Constructs a new ListGlossariesResponse. + * Constructs a new BatchDocumentInputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IListGlossariesResponse); + constructor(properties?: google.cloud.translation.v3.IBatchDocumentInputConfig); - /** ListGlossariesResponse glossaries. */ - public glossaries: google.cloud.translation.v3.IGlossary[]; + /** BatchDocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); - /** ListGlossariesResponse nextPageToken. */ - public nextPageToken: string; + /** BatchDocumentInputConfig source. */ + public source?: "gcsSource"; /** - * Creates a new ListGlossariesResponse instance using the specified properties. + * Creates a new BatchDocumentInputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns ListGlossariesResponse instance + * @returns BatchDocumentInputConfig instance */ - public static create(properties?: google.cloud.translation.v3.IListGlossariesResponse): google.cloud.translation.v3.ListGlossariesResponse; + public static create(properties?: google.cloud.translation.v3.IBatchDocumentInputConfig): google.cloud.translation.v3.BatchDocumentInputConfig; /** - * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. - * @param message ListGlossariesResponse message or plain object to encode + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. - * @param message ListGlossariesResponse message or plain object to encode + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListGlossariesResponse + * @returns BatchDocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchDocumentInputConfig; /** - * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListGlossariesResponse + * @returns BatchDocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchDocumentInputConfig; /** - * Verifies a ListGlossariesResponse message. + * Verifies a BatchDocumentInputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListGlossariesResponse + * @returns BatchDocumentInputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchDocumentInputConfig; /** - * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. - * @param message ListGlossariesResponse + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentInputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.ListGlossariesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.BatchDocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListGlossariesResponse to JSON. + * Converts this BatchDocumentInputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CreateGlossaryMetadata. */ - interface ICreateGlossaryMetadata { - - /** CreateGlossaryMetadata name */ - name?: (string|null); - - /** CreateGlossaryMetadata state */ - state?: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State|null); + /** Properties of a BatchDocumentOutputConfig. */ + interface IBatchDocumentOutputConfig { - /** CreateGlossaryMetadata submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); + /** BatchDocumentOutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); } - /** Represents a CreateGlossaryMetadata. */ - class CreateGlossaryMetadata implements ICreateGlossaryMetadata { + /** Represents a BatchDocumentOutputConfig. */ + class BatchDocumentOutputConfig implements IBatchDocumentOutputConfig { /** - * Constructs a new CreateGlossaryMetadata. + * Constructs a new BatchDocumentOutputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata); - - /** CreateGlossaryMetadata name. */ - public name: string; + constructor(properties?: google.cloud.translation.v3.IBatchDocumentOutputConfig); - /** CreateGlossaryMetadata state. */ - public state: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State); + /** BatchDocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); - /** CreateGlossaryMetadata submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); + /** BatchDocumentOutputConfig destination. */ + public destination?: "gcsDestination"; /** - * Creates a new CreateGlossaryMetadata instance using the specified properties. + * Creates a new BatchDocumentOutputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns CreateGlossaryMetadata instance + * @returns BatchDocumentOutputConfig instance */ - public static create(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata): google.cloud.translation.v3.CreateGlossaryMetadata; + public static create(properties?: google.cloud.translation.v3.IBatchDocumentOutputConfig): google.cloud.translation.v3.BatchDocumentOutputConfig; /** - * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. - * @param message CreateGlossaryMetadata message or plain object to encode + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. - * @param message CreateGlossaryMetadata message or plain object to encode + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateGlossaryMetadata + * @returns BatchDocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchDocumentOutputConfig; /** - * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateGlossaryMetadata + * @returns BatchDocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchDocumentOutputConfig; /** - * Verifies a CreateGlossaryMetadata message. + * Verifies a BatchDocumentOutputConfig message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateGlossaryMetadata + * @returns BatchDocumentOutputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchDocumentOutputConfig; /** - * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. - * @param message CreateGlossaryMetadata + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentOutputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.CreateGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.BatchDocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateGlossaryMetadata to JSON. + * Converts this BatchDocumentOutputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CreateGlossaryMetadata { + /** Properties of a BatchTranslateDocumentResponse. */ + interface IBatchTranslateDocumentResponse { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - SUCCEEDED = 2, - FAILED = 3, - CANCELLING = 4, - CANCELLED = 5 - } - } + /** BatchTranslateDocumentResponse totalPages */ + totalPages?: (number|Long|string|null); - /** Properties of a DeleteGlossaryMetadata. */ - interface IDeleteGlossaryMetadata { + /** BatchTranslateDocumentResponse translatedPages */ + translatedPages?: (number|Long|string|null); - /** DeleteGlossaryMetadata name */ - name?: (string|null); + /** BatchTranslateDocumentResponse failedPages */ + failedPages?: (number|Long|string|null); - /** DeleteGlossaryMetadata state */ - state?: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State|null); + /** BatchTranslateDocumentResponse totalBillablePages */ + totalBillablePages?: (number|Long|string|null); - /** DeleteGlossaryMetadata submitTime */ + /** BatchTranslateDocumentResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse submitTime */ submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateDocumentResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); } - /** Represents a DeleteGlossaryMetadata. */ - class DeleteGlossaryMetadata implements IDeleteGlossaryMetadata { + /** Represents a BatchTranslateDocumentResponse. */ + class BatchTranslateDocumentResponse implements IBatchTranslateDocumentResponse { /** - * Constructs a new DeleteGlossaryMetadata. + * Constructs a new BatchTranslateDocumentResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata); + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentResponse); - /** DeleteGlossaryMetadata name. */ - public name: string; + /** BatchTranslateDocumentResponse totalPages. */ + public totalPages: (number|Long|string); - /** DeleteGlossaryMetadata state. */ - public state: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State); + /** BatchTranslateDocumentResponse translatedPages. */ + public translatedPages: (number|Long|string); - /** DeleteGlossaryMetadata submitTime. */ + /** BatchTranslateDocumentResponse failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse submitTime. */ public submitTime?: (google.protobuf.ITimestamp|null); + /** BatchTranslateDocumentResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + /** - * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteGlossaryMetadata instance + * @returns BatchTranslateDocumentResponse instance */ - public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata): google.cloud.translation.v3.DeleteGlossaryMetadata; + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentResponse): google.cloud.translation.v3.BatchTranslateDocumentResponse; /** - * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. - * @param message DeleteGlossaryMetadata message or plain object to encode + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. - * @param message DeleteGlossaryMetadata message or plain object to encode + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteGlossaryMetadata + * @returns BatchTranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentResponse; /** - * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteGlossaryMetadata + * @returns BatchTranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentResponse; /** - * Verifies a DeleteGlossaryMetadata message. + * Verifies a BatchTranslateDocumentResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteGlossaryMetadata + * @returns BatchTranslateDocumentResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentResponse; /** - * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. - * @param message DeleteGlossaryMetadata + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.DeleteGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteGlossaryMetadata to JSON. + * Converts this BatchTranslateDocumentResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace DeleteGlossaryMetadata { + /** Properties of a BatchTranslateDocumentMetadata. */ + interface IBatchTranslateDocumentMetadata { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - SUCCEEDED = 2, - FAILED = 3, - CANCELLING = 4, - CANCELLED = 5 - } - } + /** BatchTranslateDocumentMetadata state */ + state?: (google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|null); - /** Properties of a DeleteGlossaryResponse. */ - interface IDeleteGlossaryResponse { + /** BatchTranslateDocumentMetadata totalPages */ + totalPages?: (number|Long|string|null); - /** DeleteGlossaryResponse name */ - name?: (string|null); + /** BatchTranslateDocumentMetadata translatedPages */ + translatedPages?: (number|Long|string|null); - /** DeleteGlossaryResponse submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); + /** BatchTranslateDocumentMetadata failedPages */ + failedPages?: (number|Long|string|null); - /** DeleteGlossaryResponse endTime */ - endTime?: (google.protobuf.ITimestamp|null); + /** BatchTranslateDocumentMetadata totalBillablePages */ + totalBillablePages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); } - /** Represents a DeleteGlossaryResponse. */ - class DeleteGlossaryResponse implements IDeleteGlossaryResponse { + /** Represents a BatchTranslateDocumentMetadata. */ + class BatchTranslateDocumentMetadata implements IBatchTranslateDocumentMetadata { /** - * Constructs a new DeleteGlossaryResponse. + * Constructs a new BatchTranslateDocumentMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse); + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentMetadata); - /** DeleteGlossaryResponse name. */ - public name: string; + /** BatchTranslateDocumentMetadata state. */ + public state: (google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateDocumentMetadata.State); - /** DeleteGlossaryResponse submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); + /** BatchTranslateDocumentMetadata totalPages. */ + public totalPages: (number|Long|string); - /** DeleteGlossaryResponse endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** BatchTranslateDocumentMetadata translatedPages. */ + public translatedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new DeleteGlossaryResponse instance using the specified properties. + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteGlossaryResponse instance + * @returns BatchTranslateDocumentMetadata instance */ - public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse): google.cloud.translation.v3.DeleteGlossaryResponse; + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentMetadata): google.cloud.translation.v3.BatchTranslateDocumentMetadata; /** - * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. - * @param message DeleteGlossaryResponse message or plain object to encode + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. - * @param message DeleteGlossaryResponse message or plain object to encode + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteGlossaryResponse + * @returns BatchTranslateDocumentMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentMetadata; /** - * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteGlossaryResponse + * @returns BatchTranslateDocumentMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentMetadata; /** - * Verifies a DeleteGlossaryResponse message. + * Verifies a BatchTranslateDocumentMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteGlossaryResponse + * @returns BatchTranslateDocumentMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentMetadata; /** - * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. - * @param message DeleteGlossaryResponse + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.translation.v3.DeleteGlossaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteGlossaryResponse to JSON. + * Converts this BatchTranslateDocumentMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + + namespace BatchTranslateDocumentMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } } /** Namespace v3beta1. */ @@ -7031,6 +8238,9 @@ export namespace google { /** BatchTranslateDocumentRequest glossaries */ glossaries?: ({ [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateDocumentRequest formatConversions */ + formatConversions?: ({ [k: string]: string }|null); } /** Represents a BatchTranslateDocumentRequest. */ @@ -7063,6 +8273,9 @@ export namespace google { /** BatchTranslateDocumentRequest glossaries. */ public glossaries: { [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }; + /** BatchTranslateDocumentRequest formatConversions. */ + public formatConversions: { [k: string]: string }; + /** * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index e26dff40..19bd110e 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -197,6 +197,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService#translateDocument}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef TranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.TranslateDocumentResponse} [response] TranslateDocumentResponse + */ + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.TranslateDocumentCallback} callback Node-style callback called with the error, if any, and TranslateDocumentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.translateDocument = function translateDocument(request, callback) { + return this.rpcCall(translateDocument, $root.google.cloud.translation.v3.TranslateDocumentRequest, $root.google.cloud.translation.v3.TranslateDocumentResponse, request, callback); + }, "name", { value: "TranslateDocument" }); + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.translation.v3.TranslationService#batchTranslateText}. * @memberof google.cloud.translation.v3.TranslationService @@ -230,6 +263,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService#batchTranslateDocument}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef BatchTranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.BatchTranslateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.batchTranslateDocument = function batchTranslateDocument(request, callback) { + return this.rpcCall(batchTranslateDocument, $root.google.cloud.translation.v3.BatchTranslateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchTranslateDocument" }); + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.translation.v3.TranslationService#createGlossary}. * @memberof google.cloud.translation.v3.TranslationService @@ -3748,36 +3814,26 @@ return OutputConfig; })(); - v3.BatchTranslateTextRequest = (function() { + v3.DocumentInputConfig = (function() { /** - * Properties of a BatchTranslateTextRequest. + * Properties of a DocumentInputConfig. * @memberof google.cloud.translation.v3 - * @interface IBatchTranslateTextRequest - * @property {string|null} [parent] BatchTranslateTextRequest parent - * @property {string|null} [sourceLanguageCode] BatchTranslateTextRequest sourceLanguageCode - * @property {Array.|null} [targetLanguageCodes] BatchTranslateTextRequest targetLanguageCodes - * @property {Object.|null} [models] BatchTranslateTextRequest models - * @property {Array.|null} [inputConfigs] BatchTranslateTextRequest inputConfigs - * @property {google.cloud.translation.v3.IOutputConfig|null} [outputConfig] BatchTranslateTextRequest outputConfig - * @property {Object.|null} [glossaries] BatchTranslateTextRequest glossaries - * @property {Object.|null} [labels] BatchTranslateTextRequest labels + * @interface IDocumentInputConfig + * @property {Uint8Array|null} [content] DocumentInputConfig content + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] DocumentInputConfig gcsSource + * @property {string|null} [mimeType] DocumentInputConfig mimeType */ /** - * Constructs a new BatchTranslateTextRequest. + * Constructs a new DocumentInputConfig. * @memberof google.cloud.translation.v3 - * @classdesc Represents a BatchTranslateTextRequest. - * @implements IBatchTranslateTextRequest + * @classdesc Represents a DocumentInputConfig. + * @implements IDocumentInputConfig * @constructor - * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set + * @param {google.cloud.translation.v3.IDocumentInputConfig=} [properties] Properties to set */ - function BatchTranslateTextRequest(properties) { - this.targetLanguageCodes = []; - this.models = {}; - this.inputConfigs = []; - this.glossaries = {}; - this.labels = {}; + function DocumentInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3785,237 +3841,118 @@ } /** - * BatchTranslateTextRequest parent. - * @member {string} parent - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest - * @instance - */ - BatchTranslateTextRequest.prototype.parent = ""; - - /** - * BatchTranslateTextRequest sourceLanguageCode. - * @member {string} sourceLanguageCode - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest - * @instance - */ - BatchTranslateTextRequest.prototype.sourceLanguageCode = ""; - - /** - * BatchTranslateTextRequest targetLanguageCodes. - * @member {Array.} targetLanguageCodes - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest - * @instance - */ - BatchTranslateTextRequest.prototype.targetLanguageCodes = $util.emptyArray; - - /** - * BatchTranslateTextRequest models. - * @member {Object.} models - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * DocumentInputConfig content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.translation.v3.DocumentInputConfig * @instance */ - BatchTranslateTextRequest.prototype.models = $util.emptyObject; + DocumentInputConfig.prototype.content = null; /** - * BatchTranslateTextRequest inputConfigs. - * @member {Array.} inputConfigs - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * DocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.DocumentInputConfig * @instance */ - BatchTranslateTextRequest.prototype.inputConfigs = $util.emptyArray; + DocumentInputConfig.prototype.gcsSource = null; /** - * BatchTranslateTextRequest outputConfig. - * @member {google.cloud.translation.v3.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * DocumentInputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentInputConfig * @instance */ - BatchTranslateTextRequest.prototype.outputConfig = null; + DocumentInputConfig.prototype.mimeType = ""; - /** - * BatchTranslateTextRequest glossaries. - * @member {Object.} glossaries - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest - * @instance - */ - BatchTranslateTextRequest.prototype.glossaries = $util.emptyObject; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * BatchTranslateTextRequest labels. - * @member {Object.} labels - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * DocumentInputConfig source. + * @member {"content"|"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.DocumentInputConfig * @instance */ - BatchTranslateTextRequest.prototype.labels = $util.emptyObject; + Object.defineProperty(DocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content", "gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new BatchTranslateTextRequest instance using the specified properties. + * Creates a new DocumentInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set - * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest instance + * @param {google.cloud.translation.v3.IDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig instance */ - BatchTranslateTextRequest.create = function create(properties) { - return new BatchTranslateTextRequest(properties); + DocumentInputConfig.create = function create(properties) { + return new DocumentInputConfig(properties); }; /** - * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateTextRequest.encode = function encode(message, writer) { + DocumentInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); - if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) - for (var i = 0; i < message.targetLanguageCodes.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); - if (message.models != null && Object.hasOwnProperty.call(message, "models")) - for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); - if (message.inputConfigs != null && message.inputConfigs.length) - for (var i = 0; i < message.inputConfigs.length; ++i) - $root.google.cloud.translation.v3.InputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.translation.v3.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) - for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); - } - if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) - for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mimeType); return writer; }; /** - * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + DocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * Decodes a DocumentInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateTextRequest.decode = function decode(reader, length) { + DocumentInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DocumentInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.content = reader.bytes(); break; case 2: - message.sourceLanguageCode = reader.string(); - break; - case 3: - if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) - message.targetLanguageCodes = []; - message.targetLanguageCodes.push(reader.string()); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); break; case 4: - if (message.models === $util.emptyObject) - message.models = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.models[key] = value; - break; - case 5: - if (!(message.inputConfigs && message.inputConfigs.length)) - message.inputConfigs = []; - message.inputConfigs.push($root.google.cloud.translation.v3.InputConfig.decode(reader, reader.uint32())); + message.mimeType = reader.string(); break; - case 6: - message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.decode(reader, reader.uint32()); - break; - case 7: - if (message.glossaries === $util.emptyObject) - message.glossaries = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.glossaries[key] = value; - break; - case 9: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.labels[key] = value; - break; - default: - reader.skipType(tag & 7); + default: + reader.skipType(tag & 7); break; } } @@ -4023,251 +3960,144 @@ }; /** - * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + DocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchTranslateTextRequest message. + * Verifies a DocumentInputConfig message. * @function verify - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchTranslateTextRequest.verify = function verify(message) { + DocumentInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) - if (!$util.isString(message.sourceLanguageCode)) - return "sourceLanguageCode: string expected"; - if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { - if (!Array.isArray(message.targetLanguageCodes)) - return "targetLanguageCodes: array expected"; - for (var i = 0; i < message.targetLanguageCodes.length; ++i) - if (!$util.isString(message.targetLanguageCodes[i])) - return "targetLanguageCodes: string[] expected"; - } - if (message.models != null && message.hasOwnProperty("models")) { - if (!$util.isObject(message.models)) - return "models: object expected"; - var key = Object.keys(message.models); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.models[key[i]])) - return "models: string{k:string} expected"; - } - if (message.inputConfigs != null && message.hasOwnProperty("inputConfigs")) { - if (!Array.isArray(message.inputConfigs)) - return "inputConfigs: array expected"; - for (var i = 0; i < message.inputConfigs.length; ++i) { - var error = $root.google.cloud.translation.v3.InputConfig.verify(message.inputConfigs[i]); - if (error) - return "inputConfigs." + error; - } - } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.translation.v3.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; + var properties = {}; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; } - if (message.glossaries != null && message.hasOwnProperty("glossaries")) { - if (!$util.isObject(message.glossaries)) - return "glossaries: object expected"; - var key = Object.keys(message.glossaries); - for (var i = 0; i < key.length; ++i) { - var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.translation.v3.GcsSource.verify(message.gcsSource); if (error) - return "glossaries." + error; + return "gcsSource." + error; } } - if (message.labels != null && message.hasOwnProperty("labels")) { - if (!$util.isObject(message.labels)) - return "labels: object expected"; - var key = Object.keys(message.labels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.labels[key[i]])) - return "labels: string{k:string} expected"; - } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig */ - BatchTranslateTextRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.BatchTranslateTextRequest) + DocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentInputConfig) return object; - var message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.sourceLanguageCode != null) - message.sourceLanguageCode = String(object.sourceLanguageCode); - if (object.targetLanguageCodes) { - if (!Array.isArray(object.targetLanguageCodes)) - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.targetLanguageCodes: array expected"); - message.targetLanguageCodes = []; - for (var i = 0; i < object.targetLanguageCodes.length; ++i) - message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); - } - if (object.models) { - if (typeof object.models !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.models: object expected"); - message.models = {}; - for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) - message.models[keys[i]] = String(object.models[keys[i]]); - } - if (object.inputConfigs) { - if (!Array.isArray(object.inputConfigs)) - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: array expected"); - message.inputConfigs = []; - for (var i = 0; i < object.inputConfigs.length; ++i) { - if (typeof object.inputConfigs[i] !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: object expected"); - message.inputConfigs[i] = $root.google.cloud.translation.v3.InputConfig.fromObject(object.inputConfigs[i]); - } - } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.fromObject(object.outputConfig); - } - if (object.glossaries) { - if (typeof object.glossaries !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); - message.glossaries = {}; - for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { - if (typeof object.glossaries[keys[i]] !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); - message.glossaries[keys[i]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); - } - } - if (object.labels) { - if (typeof object.labels !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.labels: object expected"); - message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) - message.labels[keys[i]] = String(object.labels[keys[i]]); + var message = new $root.google.cloud.translation.v3.DocumentInputConfig(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.DocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @static - * @param {google.cloud.translation.v3.BatchTranslateTextRequest} message BatchTranslateTextRequest + * @param {google.cloud.translation.v3.DocumentInputConfig} message DocumentInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchTranslateTextRequest.toObject = function toObject(message, options) { + DocumentInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.targetLanguageCodes = []; - object.inputConfigs = []; - } - if (options.objects || options.defaults) { - object.models = {}; - object.glossaries = {}; - object.labels = {}; - } - if (options.defaults) { - object.parent = ""; - object.sourceLanguageCode = ""; - object.outputConfig = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) - object.sourceLanguageCode = message.sourceLanguageCode; - if (message.targetLanguageCodes && message.targetLanguageCodes.length) { - object.targetLanguageCodes = []; - for (var j = 0; j < message.targetLanguageCodes.length; ++j) - object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; - } - var keys2; - if (message.models && (keys2 = Object.keys(message.models)).length) { - object.models = {}; - for (var j = 0; j < keys2.length; ++j) - object.models[keys2[j]] = message.models[keys2[j]]; - } - if (message.inputConfigs && message.inputConfigs.length) { - object.inputConfigs = []; - for (var j = 0; j < message.inputConfigs.length; ++j) - object.inputConfigs[j] = $root.google.cloud.translation.v3.InputConfig.toObject(message.inputConfigs[j], options); - } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.translation.v3.OutputConfig.toObject(message.outputConfig, options); - if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { - object.glossaries = {}; - for (var j = 0; j < keys2.length; ++j) - object.glossaries[keys2[j]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + if (options.defaults) + object.mimeType = ""; + if (message.content != null && message.hasOwnProperty("content")) { + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (options.oneofs) + object.source = "content"; } - if (message.labels && (keys2 = Object.keys(message.labels)).length) { - object.labels = {}; - for (var j = 0; j < keys2.length; ++j) - object.labels[keys2[j]] = message.labels[keys2[j]]; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; return object; }; /** - * Converts this BatchTranslateTextRequest to JSON. + * Converts this DocumentInputConfig to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @memberof google.cloud.translation.v3.DocumentInputConfig * @instance * @returns {Object.} JSON object */ - BatchTranslateTextRequest.prototype.toJSON = function toJSON() { + DocumentInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchTranslateTextRequest; + return DocumentInputConfig; })(); - v3.BatchTranslateMetadata = (function() { + v3.DocumentOutputConfig = (function() { /** - * Properties of a BatchTranslateMetadata. + * Properties of a DocumentOutputConfig. * @memberof google.cloud.translation.v3 - * @interface IBatchTranslateMetadata - * @property {google.cloud.translation.v3.BatchTranslateMetadata.State|null} [state] BatchTranslateMetadata state - * @property {number|Long|null} [translatedCharacters] BatchTranslateMetadata translatedCharacters - * @property {number|Long|null} [failedCharacters] BatchTranslateMetadata failedCharacters - * @property {number|Long|null} [totalCharacters] BatchTranslateMetadata totalCharacters - * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateMetadata submitTime + * @interface IDocumentOutputConfig + * @property {google.cloud.translation.v3.IGcsDestination|null} [gcsDestination] DocumentOutputConfig gcsDestination + * @property {string|null} [mimeType] DocumentOutputConfig mimeType */ /** - * Constructs a new BatchTranslateMetadata. + * Constructs a new DocumentOutputConfig. * @memberof google.cloud.translation.v3 - * @classdesc Represents a BatchTranslateMetadata. - * @implements IBatchTranslateMetadata + * @classdesc Represents a DocumentOutputConfig. + * @implements IDocumentOutputConfig * @constructor - * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set + * @param {google.cloud.translation.v3.IDocumentOutputConfig=} [properties] Properties to set */ - function BatchTranslateMetadata(properties) { + function DocumentOutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4275,127 +4105,102 @@ } /** - * BatchTranslateMetadata state. - * @member {google.cloud.translation.v3.BatchTranslateMetadata.State} state - * @memberof google.cloud.translation.v3.BatchTranslateMetadata - * @instance - */ - BatchTranslateMetadata.prototype.state = 0; - - /** - * BatchTranslateMetadata translatedCharacters. - * @member {number|Long} translatedCharacters - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * DocumentOutputConfig gcsDestination. + * @member {google.cloud.translation.v3.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @instance */ - BatchTranslateMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DocumentOutputConfig.prototype.gcsDestination = null; /** - * BatchTranslateMetadata failedCharacters. - * @member {number|Long} failedCharacters - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * DocumentOutputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @instance */ - BatchTranslateMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DocumentOutputConfig.prototype.mimeType = ""; - /** - * BatchTranslateMetadata totalCharacters. - * @member {number|Long} totalCharacters - * @memberof google.cloud.translation.v3.BatchTranslateMetadata - * @instance - */ - BatchTranslateMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * BatchTranslateMetadata submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * DocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @instance */ - BatchTranslateMetadata.prototype.submitTime = null; + Object.defineProperty(DocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new BatchTranslateMetadata instance using the specified properties. + * Creates a new DocumentOutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set - * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata instance + * @param {google.cloud.translation.v3.IDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig instance */ - BatchTranslateMetadata.create = function create(properties) { - return new BatchTranslateMetadata(properties); + DocumentOutputConfig.create = function create(properties) { + return new DocumentOutputConfig(properties); }; /** - * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateMetadata.encode = function encode(message, writer) { + DocumentOutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); - if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); - if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalCharacters); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); return writer; }; /** - * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static - * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentOutputConfig} message DocumentOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateMetadata.encodeDelimited = function encodeDelimited(message, writer) { + DocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * Decodes a DocumentOutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateMetadata.decode = function decode(reader, length) { + DocumentOutputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DocumentOutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 2: - message.translatedCharacters = reader.int64(); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.decode(reader, reader.uint32()); break; case 3: - message.failedCharacters = reader.int64(); - break; - case 4: - message.totalCharacters = reader.int64(); - break; - case 5: - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -4406,246 +4211,134 @@ }; /** - * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * Decodes a DocumentOutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateMetadata.decodeDelimited = function decodeDelimited(reader) { + DocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchTranslateMetadata message. + * Verifies a DocumentOutputConfig message. * @function verify - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchTranslateMetadata.verify = function verify(message) { + DocumentOutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.translation.v3.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; } - if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) - if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) - return "translatedCharacters: integer|Long expected"; - if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) - if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) - return "failedCharacters: integer|Long expected"; - if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) - if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) - return "totalCharacters: integer|Long expected"; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); - if (error) - return "submitTime." + error; } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig */ - BatchTranslateMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.BatchTranslateMetadata) + DocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentOutputConfig) return object; - var message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "SUCCEEDED": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLING": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.translatedCharacters != null) - if ($util.Long) - (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; - else if (typeof object.translatedCharacters === "string") - message.translatedCharacters = parseInt(object.translatedCharacters, 10); - else if (typeof object.translatedCharacters === "number") - message.translatedCharacters = object.translatedCharacters; - else if (typeof object.translatedCharacters === "object") - message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); - if (object.failedCharacters != null) - if ($util.Long) - (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; - else if (typeof object.failedCharacters === "string") - message.failedCharacters = parseInt(object.failedCharacters, 10); - else if (typeof object.failedCharacters === "number") - message.failedCharacters = object.failedCharacters; - else if (typeof object.failedCharacters === "object") - message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); - if (object.totalCharacters != null) - if ($util.Long) - (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; - else if (typeof object.totalCharacters === "string") - message.totalCharacters = parseInt(object.totalCharacters, 10); - else if (typeof object.totalCharacters === "number") - message.totalCharacters = object.totalCharacters; - else if (typeof object.totalCharacters === "object") - message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateMetadata.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + var message = new $root.google.cloud.translation.v3.DocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3.DocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.fromObject(object.gcsDestination); } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @static - * @param {google.cloud.translation.v3.BatchTranslateMetadata} message BatchTranslateMetadata + * @param {google.cloud.translation.v3.DocumentOutputConfig} message DocumentOutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchTranslateMetadata.toObject = function toObject(message, options) { + DocumentOutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.translatedCharacters = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failedCharacters = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.totalCharacters = options.longs === String ? "0" : 0; - object.submitTime = null; + if (options.defaults) + object.mimeType = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.translation.v3.BatchTranslateMetadata.State[message.state] : message.state; - if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) - if (typeof message.translatedCharacters === "number") - object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; - else - object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; - if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) - if (typeof message.failedCharacters === "number") - object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; - else - object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; - if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) - if (typeof message.totalCharacters === "number") - object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; - else - object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; return object; }; /** - * Converts this BatchTranslateMetadata to JSON. + * Converts this DocumentOutputConfig to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @memberof google.cloud.translation.v3.DocumentOutputConfig * @instance * @returns {Object.} JSON object */ - BatchTranslateMetadata.prototype.toJSON = function toJSON() { + DocumentOutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.translation.v3.BatchTranslateMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} SUCCEEDED=2 SUCCEEDED value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLING=4 CANCELLING value - * @property {number} CANCELLED=5 CANCELLED value - */ - BatchTranslateMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "SUCCEEDED"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLING"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); - - return BatchTranslateMetadata; + return DocumentOutputConfig; })(); - v3.BatchTranslateResponse = (function() { + v3.TranslateDocumentRequest = (function() { /** - * Properties of a BatchTranslateResponse. + * Properties of a TranslateDocumentRequest. * @memberof google.cloud.translation.v3 - * @interface IBatchTranslateResponse - * @property {number|Long|null} [totalCharacters] BatchTranslateResponse totalCharacters - * @property {number|Long|null} [translatedCharacters] BatchTranslateResponse translatedCharacters - * @property {number|Long|null} [failedCharacters] BatchTranslateResponse failedCharacters - * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateResponse submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateResponse endTime + * @interface ITranslateDocumentRequest + * @property {string|null} [parent] TranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] TranslateDocumentRequest sourceLanguageCode + * @property {string|null} [targetLanguageCode] TranslateDocumentRequest targetLanguageCode + * @property {google.cloud.translation.v3.IDocumentInputConfig|null} [documentInputConfig] TranslateDocumentRequest documentInputConfig + * @property {google.cloud.translation.v3.IDocumentOutputConfig|null} [documentOutputConfig] TranslateDocumentRequest documentOutputConfig + * @property {string|null} [model] TranslateDocumentRequest model + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentRequest glossaryConfig + * @property {Object.|null} [labels] TranslateDocumentRequest labels */ /** - * Constructs a new BatchTranslateResponse. + * Constructs a new TranslateDocumentRequest. * @memberof google.cloud.translation.v3 - * @classdesc Represents a BatchTranslateResponse. - * @implements IBatchTranslateResponse + * @classdesc Represents a TranslateDocumentRequest. + * @implements ITranslateDocumentRequest * @constructor - * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set + * @param {google.cloud.translation.v3.ITranslateDocumentRequest=} [properties] Properties to set */ - function BatchTranslateResponse(properties) { + function TranslateDocumentRequest(properties) { + this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4653,127 +4346,186 @@ } /** - * BatchTranslateResponse totalCharacters. - * @member {number|Long} totalCharacters - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * TranslateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance */ - BatchTranslateResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + TranslateDocumentRequest.prototype.parent = ""; /** - * BatchTranslateResponse translatedCharacters. - * @member {number|Long} translatedCharacters - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * TranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance */ - BatchTranslateResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + TranslateDocumentRequest.prototype.sourceLanguageCode = ""; /** - * BatchTranslateResponse failedCharacters. - * @member {number|Long} failedCharacters - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * TranslateDocumentRequest targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance */ - BatchTranslateResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + TranslateDocumentRequest.prototype.targetLanguageCode = ""; /** - * BatchTranslateResponse submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * TranslateDocumentRequest documentInputConfig. + * @member {google.cloud.translation.v3.IDocumentInputConfig|null|undefined} documentInputConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance */ - BatchTranslateResponse.prototype.submitTime = null; + TranslateDocumentRequest.prototype.documentInputConfig = null; /** - * BatchTranslateResponse endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * TranslateDocumentRequest documentOutputConfig. + * @member {google.cloud.translation.v3.IDocumentOutputConfig|null|undefined} documentOutputConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance */ - BatchTranslateResponse.prototype.endTime = null; + TranslateDocumentRequest.prototype.documentOutputConfig = null; /** - * Creates a new BatchTranslateResponse instance using the specified properties. + * TranslateDocumentRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.model = ""; + + /** + * TranslateDocumentRequest glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.glossaryConfig = null; + + /** + * TranslateDocumentRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new TranslateDocumentRequest instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set - * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse instance + * @param {google.cloud.translation.v3.ITranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest instance */ - BatchTranslateResponse.create = function create(properties) { - return new BatchTranslateResponse(properties); + TranslateDocumentRequest.create = function create(properties) { + return new TranslateDocumentRequest(properties); }; /** - * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateResponse.encode = function encode(message, writer) { + TranslateDocumentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalCharacters); - if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); - if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCode); + if (message.documentInputConfig != null && Object.hasOwnProperty.call(message, "documentInputConfig")) + $root.google.cloud.translation.v3.DocumentInputConfig.encode(message.documentInputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.documentOutputConfig != null && Object.hasOwnProperty.call(message, "documentOutputConfig")) + $root.google.cloud.translation.v3.DocumentOutputConfig.encode(message.documentOutputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); return writer; }; /** - * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchTranslateResponse.encodeDelimited = function encodeDelimited(message, writer) { + TranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateResponse.decode = function decode(reader, length) { + TranslateDocumentRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateDocumentRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.totalCharacters = reader.int64(); + message.parent = reader.string(); break; case 2: - message.translatedCharacters = reader.int64(); + message.sourceLanguageCode = reader.string(); break; case 3: - message.failedCharacters = reader.int64(); + message.targetLanguageCode = reader.string(); break; case 4: - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.decode(reader, reader.uint32()); break; case 5: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + case 6: + message.model = reader.string(); + break; + case 7: + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; break; default: reader.skipType(tag & 7); @@ -4784,192 +4536,197 @@ }; /** - * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchTranslateResponse.decodeDelimited = function decodeDelimited(reader) { + TranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchTranslateResponse message. + * Verifies a TranslateDocumentRequest message. * @function verify - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchTranslateResponse.verify = function verify(message) { + TranslateDocumentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) - if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) - return "totalCharacters: integer|Long expected"; - if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) - if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) - return "translatedCharacters: integer|Long expected"; - if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) - if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) - return "failedCharacters: integer|Long expected"; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) { + var error = $root.google.cloud.translation.v3.DocumentInputConfig.verify(message.documentInputConfig); if (error) - return "submitTime." + error; + return "documentInputConfig." + error; } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) { + var error = $root.google.cloud.translation.v3.DocumentOutputConfig.verify(message.documentOutputConfig); if (error) - return "endTime." + error; + return "documentOutputConfig." + error; } - return null; - }; - - /** - * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.translation.v3.BatchTranslateResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse - */ - BatchTranslateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.BatchTranslateResponse) + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest + */ + TranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateDocumentRequest) return object; - var message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); - if (object.totalCharacters != null) - if ($util.Long) - (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; - else if (typeof object.totalCharacters === "string") - message.totalCharacters = parseInt(object.totalCharacters, 10); - else if (typeof object.totalCharacters === "number") - message.totalCharacters = object.totalCharacters; - else if (typeof object.totalCharacters === "object") - message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); - if (object.translatedCharacters != null) - if ($util.Long) - (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; - else if (typeof object.translatedCharacters === "string") - message.translatedCharacters = parseInt(object.translatedCharacters, 10); - else if (typeof object.translatedCharacters === "number") - message.translatedCharacters = object.translatedCharacters; - else if (typeof object.translatedCharacters === "object") - message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); - if (object.failedCharacters != null) - if ($util.Long) - (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; - else if (typeof object.failedCharacters === "string") - message.failedCharacters = parseInt(object.failedCharacters, 10); - else if (typeof object.failedCharacters === "number") - message.failedCharacters = object.failedCharacters; - else if (typeof object.failedCharacters === "object") - message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + var message = new $root.google.cloud.translation.v3.TranslateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + if (object.documentInputConfig != null) { + if (typeof object.documentInputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.documentInputConfig: object expected"); + message.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.fromObject(object.documentInputConfig); } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + if (object.documentOutputConfig != null) { + if (typeof object.documentOutputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.documentOutputConfig: object expected"); + message.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.fromObject(object.documentOutputConfig); + } + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); } return message; }; /** - * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.BatchTranslateResponse} message BatchTranslateResponse + * @param {google.cloud.translation.v3.TranslateDocumentRequest} message TranslateDocumentRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchTranslateResponse.toObject = function toObject(message, options) { + TranslateDocumentRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.labels = {}; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.totalCharacters = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.translatedCharacters = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.failedCharacters = options.longs === String ? "0" : 0; - object.submitTime = null; - object.endTime = null; + object.parent = ""; + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + object.documentInputConfig = null; + object.documentOutputConfig = null; + object.model = ""; + object.glossaryConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) + object.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.toObject(message.documentInputConfig, options); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) + object.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.toObject(message.documentOutputConfig, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; } - if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) - if (typeof message.totalCharacters === "number") - object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; - else - object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; - if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) - if (typeof message.translatedCharacters === "number") - object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; - else - object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; - if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) - if (typeof message.failedCharacters === "number") - object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; - else - object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this BatchTranslateResponse to JSON. + * Converts this TranslateDocumentRequest to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @memberof google.cloud.translation.v3.TranslateDocumentRequest * @instance * @returns {Object.} JSON object */ - BatchTranslateResponse.prototype.toJSON = function toJSON() { + TranslateDocumentRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchTranslateResponse; + return TranslateDocumentRequest; })(); - v3.GlossaryInputConfig = (function() { + v3.DocumentTranslation = (function() { /** - * Properties of a GlossaryInputConfig. + * Properties of a DocumentTranslation. * @memberof google.cloud.translation.v3 - * @interface IGlossaryInputConfig - * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] GlossaryInputConfig gcsSource + * @interface IDocumentTranslation + * @property {Array.|null} [byteStreamOutputs] DocumentTranslation byteStreamOutputs + * @property {string|null} [mimeType] DocumentTranslation mimeType + * @property {string|null} [detectedLanguageCode] DocumentTranslation detectedLanguageCode */ /** - * Constructs a new GlossaryInputConfig. + * Constructs a new DocumentTranslation. * @memberof google.cloud.translation.v3 - * @classdesc Represents a GlossaryInputConfig. - * @implements IGlossaryInputConfig + * @classdesc Represents a DocumentTranslation. + * @implements IDocumentTranslation * @constructor - * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set + * @param {google.cloud.translation.v3.IDocumentTranslation=} [properties] Properties to set */ - function GlossaryInputConfig(properties) { + function DocumentTranslation(properties) { + this.byteStreamOutputs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4977,89 +4734,104 @@ } /** - * GlossaryInputConfig gcsSource. - * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * DocumentTranslation byteStreamOutputs. + * @member {Array.} byteStreamOutputs + * @memberof google.cloud.translation.v3.DocumentTranslation * @instance */ - GlossaryInputConfig.prototype.gcsSource = null; + DocumentTranslation.prototype.byteStreamOutputs = $util.emptyArray; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * DocumentTranslation mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.mimeType = ""; /** - * GlossaryInputConfig source. - * @member {"gcsSource"|undefined} source - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * DocumentTranslation detectedLanguageCode. + * @member {string} detectedLanguageCode + * @memberof google.cloud.translation.v3.DocumentTranslation * @instance */ - Object.defineProperty(GlossaryInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), - set: $util.oneOfSetter($oneOfFields) - }); + DocumentTranslation.prototype.detectedLanguageCode = ""; /** - * Creates a new GlossaryInputConfig instance using the specified properties. + * Creates a new DocumentTranslation instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static - * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set - * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig instance + * @param {google.cloud.translation.v3.IDocumentTranslation=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation instance */ - GlossaryInputConfig.create = function create(properties) { - return new GlossaryInputConfig(properties); + DocumentTranslation.create = function create(properties) { + return new DocumentTranslation(properties); }; /** - * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static - * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentTranslation} message DocumentTranslation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GlossaryInputConfig.encode = function encode(message, writer) { + DocumentTranslation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.byteStreamOutputs != null && message.byteStreamOutputs.length) + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.byteStreamOutputs[i]); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.detectedLanguageCode != null && Object.hasOwnProperty.call(message, "detectedLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.detectedLanguageCode); return writer; }; /** - * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static - * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {google.cloud.translation.v3.IDocumentTranslation} message DocumentTranslation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GlossaryInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + DocumentTranslation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * Decodes a DocumentTranslation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GlossaryInputConfig.decode = function decode(reader, length) { + DocumentTranslation.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DocumentTranslation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + if (!(message.byteStreamOutputs && message.byteStreamOutputs.length)) + message.byteStreamOutputs = []; + message.byteStreamOutputs.push(reader.bytes()); + break; + case 2: + message.mimeType = reader.string(); + break; + case 3: + message.detectedLanguageCode = reader.string(); break; default: reader.skipType(tag & 7); @@ -5070,123 +4842,143 @@ }; /** - * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GlossaryInputConfig.decodeDelimited = function decodeDelimited(reader) { + DocumentTranslation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GlossaryInputConfig message. + * Verifies a DocumentTranslation message. * @function verify - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GlossaryInputConfig.verify = function verify(message) { + DocumentTranslation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - properties.source = 1; - { - var error = $root.google.cloud.translation.v3.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } + if (message.byteStreamOutputs != null && message.hasOwnProperty("byteStreamOutputs")) { + if (!Array.isArray(message.byteStreamOutputs)) + return "byteStreamOutputs: array expected"; + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + if (!(message.byteStreamOutputs[i] && typeof message.byteStreamOutputs[i].length === "number" || $util.isString(message.byteStreamOutputs[i]))) + return "byteStreamOutputs: buffer[] expected"; } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + if (!$util.isString(message.detectedLanguageCode)) + return "detectedLanguageCode: string expected"; return null; }; /** - * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation */ - GlossaryInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.GlossaryInputConfig) + DocumentTranslation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentTranslation) return object; - var message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.translation.v3.GlossaryInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.translation.v3.DocumentTranslation(); + if (object.byteStreamOutputs) { + if (!Array.isArray(object.byteStreamOutputs)) + throw TypeError(".google.cloud.translation.v3.DocumentTranslation.byteStreamOutputs: array expected"); + message.byteStreamOutputs = []; + for (var i = 0; i < object.byteStreamOutputs.length; ++i) + if (typeof object.byteStreamOutputs[i] === "string") + $util.base64.decode(object.byteStreamOutputs[i], message.byteStreamOutputs[i] = $util.newBuffer($util.base64.length(object.byteStreamOutputs[i])), 0); + else if (object.byteStreamOutputs[i].length) + message.byteStreamOutputs[i] = object.byteStreamOutputs[i]; } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.detectedLanguageCode != null) + message.detectedLanguageCode = String(object.detectedLanguageCode); return message; }; /** - * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @static - * @param {google.cloud.translation.v3.GlossaryInputConfig} message GlossaryInputConfig + * @param {google.cloud.translation.v3.DocumentTranslation} message DocumentTranslation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GlossaryInputConfig.toObject = function toObject(message, options) { + DocumentTranslation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; + if (options.arrays || options.defaults) + object.byteStreamOutputs = []; + if (options.defaults) { + object.mimeType = ""; + object.detectedLanguageCode = ""; + } + if (message.byteStreamOutputs && message.byteStreamOutputs.length) { + object.byteStreamOutputs = []; + for (var j = 0; j < message.byteStreamOutputs.length; ++j) + object.byteStreamOutputs[j] = options.bytes === String ? $util.base64.encode(message.byteStreamOutputs[j], 0, message.byteStreamOutputs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.byteStreamOutputs[j]) : message.byteStreamOutputs[j]; } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + object.detectedLanguageCode = message.detectedLanguageCode; return object; }; /** - * Converts this GlossaryInputConfig to JSON. + * Converts this DocumentTranslation to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @memberof google.cloud.translation.v3.DocumentTranslation * @instance * @returns {Object.} JSON object */ - GlossaryInputConfig.prototype.toJSON = function toJSON() { + DocumentTranslation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GlossaryInputConfig; + return DocumentTranslation; })(); - v3.Glossary = (function() { + v3.TranslateDocumentResponse = (function() { /** - * Properties of a Glossary. + * Properties of a TranslateDocumentResponse. * @memberof google.cloud.translation.v3 - * @interface IGlossary - * @property {string|null} [name] Glossary name - * @property {google.cloud.translation.v3.Glossary.ILanguageCodePair|null} [languagePair] Glossary languagePair - * @property {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null} [languageCodesSet] Glossary languageCodesSet - * @property {google.cloud.translation.v3.IGlossaryInputConfig|null} [inputConfig] Glossary inputConfig - * @property {number|null} [entryCount] Glossary entryCount - * @property {google.protobuf.ITimestamp|null} [submitTime] Glossary submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] Glossary endTime + * @interface ITranslateDocumentResponse + * @property {google.cloud.translation.v3.IDocumentTranslation|null} [documentTranslation] TranslateDocumentResponse documentTranslation + * @property {google.cloud.translation.v3.IDocumentTranslation|null} [glossaryDocumentTranslation] TranslateDocumentResponse glossaryDocumentTranslation + * @property {string|null} [model] TranslateDocumentResponse model + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentResponse glossaryConfig */ /** - * Constructs a new Glossary. + * Constructs a new TranslateDocumentResponse. * @memberof google.cloud.translation.v3 - * @classdesc Represents a Glossary. - * @implements IGlossary + * @classdesc Represents a TranslateDocumentResponse. + * @implements ITranslateDocumentResponse * @constructor - * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set + * @param {google.cloud.translation.v3.ITranslateDocumentResponse=} [properties] Properties to set */ - function Glossary(properties) { + function TranslateDocumentResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5194,167 +4986,114 @@ } /** - * Glossary name. - * @member {string} name - * @memberof google.cloud.translation.v3.Glossary - * @instance - */ - Glossary.prototype.name = ""; - - /** - * Glossary languagePair. - * @member {google.cloud.translation.v3.Glossary.ILanguageCodePair|null|undefined} languagePair - * @memberof google.cloud.translation.v3.Glossary - * @instance - */ - Glossary.prototype.languagePair = null; - - /** - * Glossary languageCodesSet. - * @member {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null|undefined} languageCodesSet - * @memberof google.cloud.translation.v3.Glossary - * @instance - */ - Glossary.prototype.languageCodesSet = null; - - /** - * Glossary inputConfig. - * @member {google.cloud.translation.v3.IGlossaryInputConfig|null|undefined} inputConfig - * @memberof google.cloud.translation.v3.Glossary - * @instance - */ - Glossary.prototype.inputConfig = null; - - /** - * Glossary entryCount. - * @member {number} entryCount - * @memberof google.cloud.translation.v3.Glossary + * TranslateDocumentResponse documentTranslation. + * @member {google.cloud.translation.v3.IDocumentTranslation|null|undefined} documentTranslation + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @instance */ - Glossary.prototype.entryCount = 0; + TranslateDocumentResponse.prototype.documentTranslation = null; /** - * Glossary submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.Glossary + * TranslateDocumentResponse glossaryDocumentTranslation. + * @member {google.cloud.translation.v3.IDocumentTranslation|null|undefined} glossaryDocumentTranslation + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @instance */ - Glossary.prototype.submitTime = null; + TranslateDocumentResponse.prototype.glossaryDocumentTranslation = null; /** - * Glossary endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.translation.v3.Glossary + * TranslateDocumentResponse model. + * @member {string} model + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @instance */ - Glossary.prototype.endTime = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + TranslateDocumentResponse.prototype.model = ""; /** - * Glossary languages. - * @member {"languagePair"|"languageCodesSet"|undefined} languages - * @memberof google.cloud.translation.v3.Glossary + * TranslateDocumentResponse glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @instance */ - Object.defineProperty(Glossary.prototype, "languages", { - get: $util.oneOfGetter($oneOfFields = ["languagePair", "languageCodesSet"]), - set: $util.oneOfSetter($oneOfFields) - }); + TranslateDocumentResponse.prototype.glossaryConfig = null; /** - * Creates a new Glossary instance using the specified properties. + * Creates a new TranslateDocumentResponse instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set - * @returns {google.cloud.translation.v3.Glossary} Glossary instance + * @param {google.cloud.translation.v3.ITranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse instance */ - Glossary.create = function create(properties) { - return new Glossary(properties); + TranslateDocumentResponse.create = function create(properties) { + return new TranslateDocumentResponse(properties); }; /** - * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {google.cloud.translation.v3.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Glossary.encode = function encode(message, writer) { + TranslateDocumentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.languagePair != null && Object.hasOwnProperty.call(message, "languagePair")) - $root.google.cloud.translation.v3.Glossary.LanguageCodePair.encode(message.languagePair, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.languageCodesSet != null && Object.hasOwnProperty.call(message, "languageCodesSet")) - $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.encode(message.languageCodesSet, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.translation.v3.GlossaryInputConfig.encode(message.inputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.entryCount != null && Object.hasOwnProperty.call(message, "entryCount")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.entryCount); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.documentTranslation != null && Object.hasOwnProperty.call(message, "documentTranslation")) + $root.google.cloud.translation.v3.DocumentTranslation.encode(message.documentTranslation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.glossaryDocumentTranslation != null && Object.hasOwnProperty.call(message, "glossaryDocumentTranslation")) + $root.google.cloud.translation.v3.DocumentTranslation.encode(message.glossaryDocumentTranslation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {google.cloud.translation.v3.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Glossary.encodeDelimited = function encodeDelimited(message, writer) { + TranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Glossary message from the specified reader or buffer. + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.Glossary} Glossary + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Glossary.decode = function decode(reader, length) { + TranslateDocumentResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateDocumentResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.decode(reader, reader.uint32()); + break; + case 2: + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.decode(reader, reader.uint32()); break; case 3: - message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.decode(reader, reader.uint32()); + message.model = reader.string(); break; case 4: - message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.decode(reader, reader.uint32()); - break; - case 5: - message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.decode(reader, reader.uint32()); - break; - case 6: - message.entryCount = reader.int32(); - break; - case 7: - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -5365,608 +5104,3423 @@ }; /** - * Decodes a Glossary message from the specified reader or buffer, length delimited. + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.Glossary} Glossary + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Glossary.decodeDelimited = function decodeDelimited(reader) { + TranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Glossary message. + * Verifies a TranslateDocumentResponse message. * @function verify - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Glossary.verify = function verify(message) { + TranslateDocumentResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.languagePair != null && message.hasOwnProperty("languagePair")) { - properties.languages = 1; - { - var error = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.verify(message.languagePair); - if (error) - return "languagePair." + error; - } + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) { + var error = $root.google.cloud.translation.v3.DocumentTranslation.verify(message.documentTranslation); + if (error) + return "documentTranslation." + error; } - if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { - if (properties.languages === 1) - return "languages: multiple values"; - properties.languages = 1; - { - var error = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.verify(message.languageCodesSet); - if (error) - return "languageCodesSet." + error; - } - } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.translation.v3.GlossaryInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.entryCount != null && message.hasOwnProperty("entryCount")) - if (!$util.isInteger(message.entryCount)) - return "entryCount: integer expected"; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) { + var error = $root.google.cloud.translation.v3.DocumentTranslation.verify(message.glossaryDocumentTranslation); if (error) - return "submitTime." + error; + return "glossaryDocumentTranslation." + error; } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); if (error) - return "endTime." + error; + return "glossaryConfig." + error; } return null; }; /** - * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.Glossary} Glossary + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse */ - Glossary.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.Glossary) + TranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateDocumentResponse) return object; - var message = new $root.google.cloud.translation.v3.Glossary(); - if (object.name != null) - message.name = String(object.name); - if (object.languagePair != null) { - if (typeof object.languagePair !== "object") - throw TypeError(".google.cloud.translation.v3.Glossary.languagePair: object expected"); - message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.fromObject(object.languagePair); - } - if (object.languageCodesSet != null) { - if (typeof object.languageCodesSet !== "object") - throw TypeError(".google.cloud.translation.v3.Glossary.languageCodesSet: object expected"); - message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.fromObject(object.languageCodesSet); - } - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.translation.v3.Glossary.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.translation.v3.TranslateDocumentResponse(); + if (object.documentTranslation != null) { + if (typeof object.documentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.documentTranslation: object expected"); + message.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.fromObject(object.documentTranslation); } - if (object.entryCount != null) - message.entryCount = object.entryCount | 0; - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.Glossary.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + if (object.glossaryDocumentTranslation != null) { + if (typeof object.glossaryDocumentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.glossaryDocumentTranslation: object expected"); + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.fromObject(object.glossaryDocumentTranslation); } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.translation.v3.Glossary.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); } return message; }; /** - * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.Glossary} message Glossary + * @param {google.cloud.translation.v3.TranslateDocumentResponse} message TranslateDocumentResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Glossary.toObject = function toObject(message, options) { + TranslateDocumentResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.inputConfig = null; - object.entryCount = 0; - object.submitTime = null; - object.endTime = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.languagePair != null && message.hasOwnProperty("languagePair")) { - object.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.toObject(message.languagePair, options); - if (options.oneofs) - object.languages = "languagePair"; - } - if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { - object.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.toObject(message.languageCodesSet, options); - if (options.oneofs) - object.languages = "languageCodesSet"; + object.documentTranslation = null; + object.glossaryDocumentTranslation = null; + object.model = ""; + object.glossaryConfig = null; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.toObject(message.inputConfig, options); - if (message.entryCount != null && message.hasOwnProperty("entryCount")) - object.entryCount = message.entryCount; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) + object.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.toObject(message.documentTranslation, options); + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) + object.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.toObject(message.glossaryDocumentTranslation, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); return object; }; /** - * Converts this Glossary to JSON. + * Converts this TranslateDocumentResponse to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.Glossary + * @memberof google.cloud.translation.v3.TranslateDocumentResponse * @instance * @returns {Object.} JSON object */ - Glossary.prototype.toJSON = function toJSON() { + TranslateDocumentResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - Glossary.LanguageCodePair = (function() { - - /** - * Properties of a LanguageCodePair. - * @memberof google.cloud.translation.v3.Glossary - * @interface ILanguageCodePair - * @property {string|null} [sourceLanguageCode] LanguageCodePair sourceLanguageCode - * @property {string|null} [targetLanguageCode] LanguageCodePair targetLanguageCode - */ + return TranslateDocumentResponse; + })(); - /** - * Constructs a new LanguageCodePair. - * @memberof google.cloud.translation.v3.Glossary - * @classdesc Represents a LanguageCodePair. - * @implements ILanguageCodePair - * @constructor - * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set - */ - function LanguageCodePair(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + v3.BatchTranslateTextRequest = (function() { - /** - * LanguageCodePair sourceLanguageCode. - * @member {string} sourceLanguageCode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @instance - */ - LanguageCodePair.prototype.sourceLanguageCode = ""; + /** + * Properties of a BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateTextRequest + * @property {string|null} [parent] BatchTranslateTextRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateTextRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateTextRequest targetLanguageCodes + * @property {Object.|null} [models] BatchTranslateTextRequest models + * @property {Array.|null} [inputConfigs] BatchTranslateTextRequest inputConfigs + * @property {google.cloud.translation.v3.IOutputConfig|null} [outputConfig] BatchTranslateTextRequest outputConfig + * @property {Object.|null} [glossaries] BatchTranslateTextRequest glossaries + * @property {Object.|null} [labels] BatchTranslateTextRequest labels + */ - /** - * LanguageCodePair targetLanguageCode. - * @member {string} targetLanguageCode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @instance - */ - LanguageCodePair.prototype.targetLanguageCode = ""; + /** + * Constructs a new BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateTextRequest. + * @implements IBatchTranslateTextRequest + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set + */ + function BatchTranslateTextRequest(properties) { + this.targetLanguageCodes = []; + this.models = {}; + this.inputConfigs = []; + this.glossaries = {}; + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new LanguageCodePair instance using the specified properties. - * @function create - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set - * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair instance - */ - LanguageCodePair.create = function create(properties) { - return new LanguageCodePair(properties); - }; + /** + * BatchTranslateTextRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.parent = ""; - /** - * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. - * @function encode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LanguageCodePair.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.sourceLanguageCode); - if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLanguageCode); - return writer; - }; + /** + * BatchTranslateTextRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.sourceLanguageCode = ""; - /** - * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LanguageCodePair.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * BatchTranslateTextRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.targetLanguageCodes = $util.emptyArray; - /** - * Decodes a LanguageCodePair message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LanguageCodePair.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sourceLanguageCode = reader.string(); - break; - case 2: - message.targetLanguageCode = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * BatchTranslateTextRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateTextRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchTranslateTextRequest outputConfig. + * @member {google.cloud.translation.v3.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.outputConfig = null; + + /** + * BatchTranslateTextRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateTextRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest instance + */ + BatchTranslateTextRequest.create = function create(properties) { + return new BatchTranslateTextRequest(properties); + }; + + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3.InputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.sourceLanguageCode = reader.string(); + break; + case 3: + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + case 4: + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + case 5: + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3.InputConfig.decode(reader, reader.uint32())); + break; + case 6: + message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.decode(reader, reader.uint32()); + break; + case 7: + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; + break; + case 9: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateTextRequest message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateTextRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: string[] expected"; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k:string} expected"; + } + if (message.inputConfigs != null && message.hasOwnProperty("inputConfigs")) { + if (!Array.isArray(message.inputConfigs)) + return "inputConfigs: array expected"; + for (var i = 0; i < message.inputConfigs.length; ++i) { + var error = $root.google.cloud.translation.v3.InputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + */ + BatchTranslateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateTextRequest) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3.InputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.fromObject(object.outputConfig); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.BatchTranslateTextRequest} message BatchTranslateTextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateTextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.labels = {}; + } + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3.InputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3.OutputConfig.toObject(message.outputConfig, options); + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this BatchTranslateTextRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateTextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchTranslateTextRequest; + })(); + + v3.BatchTranslateMetadata = (function() { + + /** + * Properties of a BatchTranslateMetadata. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateMetadata + * @property {google.cloud.translation.v3.BatchTranslateMetadata.State|null} [state] BatchTranslateMetadata state + * @property {number|Long|null} [translatedCharacters] BatchTranslateMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateMetadata failedCharacters + * @property {number|Long|null} [totalCharacters] BatchTranslateMetadata totalCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateMetadata submitTime + */ + + /** + * Constructs a new BatchTranslateMetadata. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateMetadata. + * @implements IBatchTranslateMetadata + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set + */ + function BatchTranslateMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateMetadata state. + * @member {google.cloud.translation.v3.BatchTranslateMetadata.State} state + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.state = 0; + + /** + * BatchTranslateMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata instance + */ + BatchTranslateMetadata.create = function create(properties) { + return new BatchTranslateMetadata(properties); + }; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.translatedCharacters = reader.int64(); + break; + case 3: + message.failedCharacters = reader.int64(); + break; + case 4: + message.totalCharacters = reader.int64(); + break; + case 5: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateMetadata message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + */ + BatchTranslateMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateMetadata) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.BatchTranslateMetadata} message BatchTranslateMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.BatchTranslateMetadata.State[message.state] : message.state; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.translation.v3.BatchTranslateMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateMetadata; + })(); + + v3.BatchTranslateResponse = (function() { + + /** + * Properties of a BatchTranslateResponse. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateResponse + * @property {number|Long|null} [totalCharacters] BatchTranslateResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateResponse failedCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateResponse endTime + */ + + /** + * Constructs a new BatchTranslateResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateResponse. + * @implements IBatchTranslateResponse + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set + */ + function BatchTranslateResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.submitTime = null; + + /** + * BatchTranslateResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse instance + */ + BatchTranslateResponse.create = function create(properties) { + return new BatchTranslateResponse(properties); + }; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCharacters = reader.int64(); + break; + case 2: + message.translatedCharacters = reader.int64(); + break; + case 3: + message.failedCharacters = reader.int64(); + break; + case 4: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateResponse message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + */ + BatchTranslateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateResponse) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.BatchTranslateResponse} message BatchTranslateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + object.endTime = null; + } + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchTranslateResponse; + })(); + + v3.GlossaryInputConfig = (function() { + + /** + * Properties of a GlossaryInputConfig. + * @memberof google.cloud.translation.v3 + * @interface IGlossaryInputConfig + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] GlossaryInputConfig gcsSource + */ + + /** + * Constructs a new GlossaryInputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GlossaryInputConfig. + * @implements IGlossaryInputConfig + * @constructor + * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set + */ + function GlossaryInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GlossaryInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + */ + GlossaryInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GlossaryInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + */ + Object.defineProperty(GlossaryInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig instance + */ + GlossaryInputConfig.create = function create(properties) { + return new GlossaryInputConfig(properties); + }; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GlossaryInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GlossaryInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.translation.v3.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + */ + GlossaryInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GlossaryInputConfig) + return object; + var message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.GlossaryInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.GlossaryInputConfig} message GlossaryInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GlossaryInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + * @returns {Object.} JSON object + */ + GlossaryInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GlossaryInputConfig; + })(); + + v3.Glossary = (function() { + + /** + * Properties of a Glossary. + * @memberof google.cloud.translation.v3 + * @interface IGlossary + * @property {string|null} [name] Glossary name + * @property {google.cloud.translation.v3.Glossary.ILanguageCodePair|null} [languagePair] Glossary languagePair + * @property {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null} [languageCodesSet] Glossary languageCodesSet + * @property {google.cloud.translation.v3.IGlossaryInputConfig|null} [inputConfig] Glossary inputConfig + * @property {number|null} [entryCount] Glossary entryCount + * @property {google.protobuf.ITimestamp|null} [submitTime] Glossary submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] Glossary endTime + */ + + /** + * Constructs a new Glossary. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a Glossary. + * @implements IGlossary + * @constructor + * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set + */ + function Glossary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Glossary name. + * @member {string} name + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.name = ""; + + /** + * Glossary languagePair. + * @member {google.cloud.translation.v3.Glossary.ILanguageCodePair|null|undefined} languagePair + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.languagePair = null; + + /** + * Glossary languageCodesSet. + * @member {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null|undefined} languageCodesSet + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.languageCodesSet = null; + + /** + * Glossary inputConfig. + * @member {google.cloud.translation.v3.IGlossaryInputConfig|null|undefined} inputConfig + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.inputConfig = null; + + /** + * Glossary entryCount. + * @member {number} entryCount + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.entryCount = 0; + + /** + * Glossary submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.submitTime = null; + + /** + * Glossary endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.endTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Glossary languages. + * @member {"languagePair"|"languageCodesSet"|undefined} languages + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Object.defineProperty(Glossary.prototype, "languages", { + get: $util.oneOfGetter($oneOfFields = ["languagePair", "languageCodesSet"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Glossary instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary} Glossary instance + */ + Glossary.create = function create(properties) { + return new Glossary(properties); + }; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.languagePair != null && Object.hasOwnProperty.call(message, "languagePair")) + $root.google.cloud.translation.v3.Glossary.LanguageCodePair.encode(message.languagePair, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCodesSet != null && Object.hasOwnProperty.call(message, "languageCodesSet")) + $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.encode(message.languageCodesSet, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.translation.v3.GlossaryInputConfig.encode(message.inputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entryCount != null && Object.hasOwnProperty.call(message, "entryCount")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.entryCount); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.decode(reader, reader.uint32()); + break; + case 4: + message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.decode(reader, reader.uint32()); + break; + case 5: + message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.decode(reader, reader.uint32()); + break; + case 6: + message.entryCount = reader.int32(); + break; + case 7: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Glossary message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Glossary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.languagePair != null && message.hasOwnProperty("languagePair")) { + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.verify(message.languagePair); + if (error) + return "languagePair." + error; + } + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + if (properties.languages === 1) + return "languages: multiple values"; + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.verify(message.languageCodesSet); + if (error) + return "languageCodesSet." + error; + } + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.translation.v3.GlossaryInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + if (!$util.isInteger(message.entryCount)) + return "entryCount: integer expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary} Glossary + */ + Glossary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary) + return object; + var message = new $root.google.cloud.translation.v3.Glossary(); + if (object.name != null) + message.name = String(object.name); + if (object.languagePair != null) { + if (typeof object.languagePair !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.languagePair: object expected"); + message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.fromObject(object.languagePair); + } + if (object.languageCodesSet != null) { + if (typeof object.languageCodesSet !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.languageCodesSet: object expected"); + message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.fromObject(object.languageCodesSet); + } + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.fromObject(object.inputConfig); + } + if (object.entryCount != null) + message.entryCount = object.entryCount | 0; + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.Glossary} message Glossary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Glossary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputConfig = null; + object.entryCount = 0; + object.submitTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languagePair != null && message.hasOwnProperty("languagePair")) { + object.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.toObject(message.languagePair, options); + if (options.oneofs) + object.languages = "languagePair"; + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + object.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.toObject(message.languageCodesSet, options); + if (options.oneofs) + object.languages = "languageCodesSet"; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.toObject(message.inputConfig, options); + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + object.entryCount = message.entryCount; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this Glossary to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary + * @instance + * @returns {Object.} JSON object + */ + Glossary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Glossary.LanguageCodePair = (function() { + + /** + * Properties of a LanguageCodePair. + * @memberof google.cloud.translation.v3.Glossary + * @interface ILanguageCodePair + * @property {string|null} [sourceLanguageCode] LanguageCodePair sourceLanguageCode + * @property {string|null} [targetLanguageCode] LanguageCodePair targetLanguageCode + */ + + /** + * Constructs a new LanguageCodePair. + * @memberof google.cloud.translation.v3.Glossary + * @classdesc Represents a LanguageCodePair. + * @implements ILanguageCodePair + * @constructor + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set + */ + function LanguageCodePair(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodePair sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.sourceLanguageCode = ""; + + /** + * LanguageCodePair targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.targetLanguageCode = ""; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair instance + */ + LanguageCodePair.create = function create(properties) { + return new LanguageCodePair(properties); + }; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLanguageCode); + return writer; + }; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourceLanguageCode = reader.string(); + break; + case 2: + message.targetLanguageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodePair message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodePair.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + return null; + }; + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + */ + LanguageCodePair.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodePair) + return object; + var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + return message; + }; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.LanguageCodePair} message LanguageCodePair + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodePair.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + } + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + return object; + }; + + /** + * Converts this LanguageCodePair to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + * @returns {Object.} JSON object + */ + LanguageCodePair.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LanguageCodePair; + })(); + + Glossary.LanguageCodesSet = (function() { + + /** + * Properties of a LanguageCodesSet. + * @memberof google.cloud.translation.v3.Glossary + * @interface ILanguageCodesSet + * @property {Array.|null} [languageCodes] LanguageCodesSet languageCodes + */ + + /** + * Constructs a new LanguageCodesSet. + * @memberof google.cloud.translation.v3.Glossary + * @classdesc Represents a LanguageCodesSet. + * @implements ILanguageCodesSet + * @constructor + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set + */ + function LanguageCodesSet(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodesSet languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @instance + */ + LanguageCodesSet.prototype.languageCodes = $util.emptyArray; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet instance + */ + LanguageCodesSet.create = function create(properties) { + return new LanguageCodesSet(properties); + }; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCodes[i]); + return writer; + }; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodesSet message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodesSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + return null; + }; + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + */ + LanguageCodesSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodesSet) + return object; + var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.translation.v3.Glossary.LanguageCodesSet.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + return message; + }; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.LanguageCodesSet} message LanguageCodesSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodesSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + return object; + }; + + /** + * Converts this LanguageCodesSet to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @instance + * @returns {Object.} JSON object + */ + LanguageCodesSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LanguageCodesSet; + })(); + + return Glossary; + })(); + + v3.CreateGlossaryRequest = (function() { + + /** + * Properties of a CreateGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface ICreateGlossaryRequest + * @property {string|null} [parent] CreateGlossaryRequest parent + * @property {google.cloud.translation.v3.IGlossary|null} [glossary] CreateGlossaryRequest glossary + */ + + /** + * Constructs a new CreateGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a CreateGlossaryRequest. + * @implements ICreateGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set + */ + function CreateGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateGlossaryRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.parent = ""; + + /** + * CreateGlossaryRequest glossary. + * @member {google.cloud.translation.v3.IGlossary|null|undefined} glossary + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.glossary = null; + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest instance + */ + CreateGlossaryRequest.create = function create(properties) { + return new CreateGlossaryRequest(properties); + }; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.glossary != null && Object.hasOwnProperty.call(message, "glossary")) + $root.google.cloud.translation.v3.Glossary.encode(message.glossary, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.glossary = $root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGlossaryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.glossary != null && message.hasOwnProperty("glossary")) { + var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossary); + if (error) + return "glossary." + error; + } + return null; + }; + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + */ + CreateGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.glossary != null) { + if (typeof object.glossary !== "object") + throw TypeError(".google.cloud.translation.v3.CreateGlossaryRequest.glossary: object expected"); + message.glossary = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossary); + } + return message; + }; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.CreateGlossaryRequest} message CreateGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGlossaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.glossary = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.glossary != null && message.hasOwnProperty("glossary")) + object.glossary = $root.google.cloud.translation.v3.Glossary.toObject(message.glossary, options); + return object; + }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + CreateGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateGlossaryRequest; + })(); + + v3.GetGlossaryRequest = (function() { + + /** + * Properties of a GetGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface IGetGlossaryRequest + * @property {string|null} [name] GetGlossaryRequest name + */ + + /** + * Constructs a new GetGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GetGlossaryRequest. + * @implements IGetGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set + */ + function GetGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @instance + */ + GetGlossaryRequest.prototype.name = ""; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest instance + */ + GetGlossaryRequest.create = function create(properties) { + return new GetGlossaryRequest(properties); + }; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGlossaryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + */ + GetGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GetGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.GetGlossaryRequest} message GetGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGlossaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + GetGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetGlossaryRequest; + })(); + + v3.DeleteGlossaryRequest = (function() { + + /** + * Properties of a DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface IDeleteGlossaryRequest + * @property {string|null} [name] DeleteGlossaryRequest name + */ + + /** + * Constructs a new DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DeleteGlossaryRequest. + * @implements IDeleteGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set + */ + function DeleteGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @instance + */ + DeleteGlossaryRequest.prototype.name = ""; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest instance + */ + DeleteGlossaryRequest.create = function create(properties) { + return new DeleteGlossaryRequest(properties); + }; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + */ + DeleteGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.DeleteGlossaryRequest} message DeleteGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; - /** - * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LanguageCodePair.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this DeleteGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a LanguageCodePair message. - * @function verify - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LanguageCodePair.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) - if (!$util.isString(message.sourceLanguageCode)) - return "sourceLanguageCode: string expected"; - if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) - if (!$util.isString(message.targetLanguageCode)) - return "targetLanguageCode: string expected"; - return null; - }; + return DeleteGlossaryRequest; + })(); - /** - * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair - */ - LanguageCodePair.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodePair) - return object; - var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); - if (object.sourceLanguageCode != null) - message.sourceLanguageCode = String(object.sourceLanguageCode); - if (object.targetLanguageCode != null) - message.targetLanguageCode = String(object.targetLanguageCode); - return message; - }; + v3.ListGlossariesRequest = (function() { + + /** + * Properties of a ListGlossariesRequest. + * @memberof google.cloud.translation.v3 + * @interface IListGlossariesRequest + * @property {string|null} [parent] ListGlossariesRequest parent + * @property {number|null} [pageSize] ListGlossariesRequest pageSize + * @property {string|null} [pageToken] ListGlossariesRequest pageToken + * @property {string|null} [filter] ListGlossariesRequest filter + */ + + /** + * Constructs a new ListGlossariesRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a ListGlossariesRequest. + * @implements IListGlossariesRequest + * @constructor + * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set + */ + function ListGlossariesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGlossariesRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.parent = ""; + + /** + * ListGlossariesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageSize = 0; + + /** + * ListGlossariesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageToken = ""; + + /** + * ListGlossariesRequest filter. + * @member {string} filter + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.filter = ""; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest instance + */ + ListGlossariesRequest.create = function create(properties) { + return new ListGlossariesRequest(properties); + }; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGlossariesRequest message. + * @function verify + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; - /** - * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @static - * @param {google.cloud.translation.v3.Glossary.LanguageCodePair} message LanguageCodePair - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LanguageCodePair.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.sourceLanguageCode = ""; - object.targetLanguageCode = ""; - } - if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) - object.sourceLanguageCode = message.sourceLanguageCode; - if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) - object.targetLanguageCode = message.targetLanguageCode; + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + */ + ListGlossariesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.ListGlossariesRequest) return object; - }; + var message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; - /** - * Converts this LanguageCodePair to JSON. - * @function toJSON - * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair - * @instance - * @returns {Object.} JSON object - */ - LanguageCodePair.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.ListGlossariesRequest} message ListGlossariesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; - return LanguageCodePair; - })(); + /** + * Converts this ListGlossariesRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - Glossary.LanguageCodesSet = (function() { + return ListGlossariesRequest; + })(); - /** - * Properties of a LanguageCodesSet. - * @memberof google.cloud.translation.v3.Glossary - * @interface ILanguageCodesSet - * @property {Array.|null} [languageCodes] LanguageCodesSet languageCodes - */ + v3.ListGlossariesResponse = (function() { - /** - * Constructs a new LanguageCodesSet. - * @memberof google.cloud.translation.v3.Glossary - * @classdesc Represents a LanguageCodesSet. - * @implements ILanguageCodesSet - * @constructor - * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set - */ - function LanguageCodesSet(properties) { - this.languageCodes = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a ListGlossariesResponse. + * @memberof google.cloud.translation.v3 + * @interface IListGlossariesResponse + * @property {Array.|null} [glossaries] ListGlossariesResponse glossaries + * @property {string|null} [nextPageToken] ListGlossariesResponse nextPageToken + */ - /** - * LanguageCodesSet languageCodes. - * @member {Array.} languageCodes - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @instance - */ - LanguageCodesSet.prototype.languageCodes = $util.emptyArray; + /** + * Constructs a new ListGlossariesResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a ListGlossariesResponse. + * @implements IListGlossariesResponse + * @constructor + * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set + */ + function ListGlossariesResponse(properties) { + this.glossaries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new LanguageCodesSet instance using the specified properties. - * @function create - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set - * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet instance - */ - LanguageCodesSet.create = function create(properties) { - return new LanguageCodesSet(properties); - }; + /** + * ListGlossariesResponse glossaries. + * @member {Array.} glossaries + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.glossaries = $util.emptyArray; - /** - * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. - * @function encode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LanguageCodesSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.languageCodes != null && message.languageCodes.length) - for (var i = 0; i < message.languageCodes.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCodes[i]); - return writer; - }; + /** + * ListGlossariesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.nextPageToken = ""; - /** - * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LanguageCodesSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse instance + */ + ListGlossariesResponse.create = function create(properties) { + return new ListGlossariesResponse(properties); + }; - /** - * Decodes a LanguageCodesSet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LanguageCodesSet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.languageCodes && message.languageCodes.length)) - message.languageCodes = []; - message.languageCodes.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.glossaries != null && message.glossaries.length) + for (var i = 0; i < message.glossaries.length; ++i) + $root.google.cloud.translation.v3.Glossary.encode(message.glossaries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; - /** - * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LanguageCodesSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Verifies a LanguageCodesSet message. - * @function verify - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LanguageCodesSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { - if (!Array.isArray(message.languageCodes)) - return "languageCodes: array expected"; - for (var i = 0; i < message.languageCodes.length; ++i) - if (!$util.isString(message.languageCodes[i])) - return "languageCodes: string[] expected"; + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.glossaries && message.glossaries.length)) + message.glossaries = []; + message.glossaries.push($root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; } - return null; - }; + } + return message; + }; - /** - * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet - */ - LanguageCodesSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodesSet) - return object; - var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); - if (object.languageCodes) { - if (!Array.isArray(object.languageCodes)) - throw TypeError(".google.cloud.translation.v3.Glossary.LanguageCodesSet.languageCodes: array expected"); - message.languageCodes = []; - for (var i = 0; i < object.languageCodes.length; ++i) - message.languageCodes[i] = String(object.languageCodes[i]); - } - return message; - }; + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @static - * @param {google.cloud.translation.v3.Glossary.LanguageCodesSet} message LanguageCodesSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LanguageCodesSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.languageCodes = []; - if (message.languageCodes && message.languageCodes.length) { - object.languageCodes = []; - for (var j = 0; j < message.languageCodes.length; ++j) - object.languageCodes[j] = message.languageCodes[j]; + /** + * Verifies a ListGlossariesResponse message. + * @function verify + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!Array.isArray(message.glossaries)) + return "glossaries: array expected"; + for (var i = 0; i < message.glossaries.length; ++i) { + var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossaries[i]); + if (error) + return "glossaries." + error; } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + */ + ListGlossariesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.ListGlossariesResponse) return object; - }; + var message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); + if (object.glossaries) { + if (!Array.isArray(object.glossaries)) + throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: array expected"); + message.glossaries = []; + for (var i = 0; i < object.glossaries.length; ++i) { + if (typeof object.glossaries[i] !== "object") + throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: object expected"); + message.glossaries[i] = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossaries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; - /** - * Converts this LanguageCodesSet to JSON. - * @function toJSON - * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet - * @instance - * @returns {Object.} JSON object - */ - LanguageCodesSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.ListGlossariesResponse} message ListGlossariesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.glossaries = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.glossaries && message.glossaries.length) { + object.glossaries = []; + for (var j = 0; j < message.glossaries.length; ++j) + object.glossaries[j] = $root.google.cloud.translation.v3.Glossary.toObject(message.glossaries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; - return LanguageCodesSet; - })(); + /** + * Converts this ListGlossariesResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Glossary; + return ListGlossariesResponse; })(); - v3.CreateGlossaryRequest = (function() { + v3.CreateGlossaryMetadata = (function() { /** - * Properties of a CreateGlossaryRequest. + * Properties of a CreateGlossaryMetadata. * @memberof google.cloud.translation.v3 - * @interface ICreateGlossaryRequest - * @property {string|null} [parent] CreateGlossaryRequest parent - * @property {google.cloud.translation.v3.IGlossary|null} [glossary] CreateGlossaryRequest glossary + * @interface ICreateGlossaryMetadata + * @property {string|null} [name] CreateGlossaryMetadata name + * @property {google.cloud.translation.v3.CreateGlossaryMetadata.State|null} [state] CreateGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] CreateGlossaryMetadata submitTime */ /** - * Constructs a new CreateGlossaryRequest. + * Constructs a new CreateGlossaryMetadata. * @memberof google.cloud.translation.v3 - * @classdesc Represents a CreateGlossaryRequest. - * @implements ICreateGlossaryRequest + * @classdesc Represents a CreateGlossaryMetadata. + * @implements ICreateGlossaryMetadata * @constructor - * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set */ - function CreateGlossaryRequest(properties) { + function CreateGlossaryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5974,88 +8528,101 @@ } /** - * CreateGlossaryRequest parent. - * @member {string} parent - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * CreateGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @instance */ - CreateGlossaryRequest.prototype.parent = ""; + CreateGlossaryMetadata.prototype.name = ""; /** - * CreateGlossaryRequest glossary. - * @member {google.cloud.translation.v3.IGlossary|null|undefined} glossary - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * CreateGlossaryMetadata state. + * @member {google.cloud.translation.v3.CreateGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @instance */ - CreateGlossaryRequest.prototype.glossary = null; + CreateGlossaryMetadata.prototype.state = 0; /** - * Creates a new CreateGlossaryRequest instance using the specified properties. + * CreateGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.submitTime = null; + + /** + * Creates a new CreateGlossaryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static - * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set - * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest instance + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata instance */ - CreateGlossaryRequest.create = function create(properties) { - return new CreateGlossaryRequest(properties); + CreateGlossaryMetadata.create = function create(properties) { + return new CreateGlossaryMetadata(properties); }; /** - * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static - * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateGlossaryRequest.encode = function encode(message, writer) { + CreateGlossaryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.glossary != null && Object.hasOwnProperty.call(message, "glossary")) - $root.google.cloud.translation.v3.Glossary.encode(message.glossary, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static - * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateGlossaryRequest.decode = function decode(reader, length) { + CreateGlossaryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.name = reader.string(); break; case 2: - message.glossary = $root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32()); + message.state = reader.int32(); + break; + case 3: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -6066,121 +8633,186 @@ }; /** - * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + CreateGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateGlossaryRequest message. + * Verifies a CreateGlossaryMetadata message. * @function verify - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateGlossaryRequest.verify = function verify(message) { + CreateGlossaryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.glossary != null && message.hasOwnProperty("glossary")) { - var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossary); + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); if (error) - return "glossary." + error; + return "submitTime." + error; } return null; }; /** - * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata */ - CreateGlossaryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryRequest) + CreateGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryMetadata) return object; - var message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.glossary != null) { - if (typeof object.glossary !== "object") - throw TypeError(".google.cloud.translation.v3.CreateGlossaryRequest.glossary: object expected"); - message.glossary = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossary); + var message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); + if (object.name != null) + message.name = String(object.name); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.CreateGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); } return message; }; /** - * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @static - * @param {google.cloud.translation.v3.CreateGlossaryRequest} message CreateGlossaryRequest + * @param {google.cloud.translation.v3.CreateGlossaryMetadata} message CreateGlossaryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateGlossaryRequest.toObject = function toObject(message, options) { + CreateGlossaryMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.parent = ""; - object.glossary = null; + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.glossary != null && message.hasOwnProperty("glossary")) - object.glossary = $root.google.cloud.translation.v3.Glossary.toObject(message.glossary, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.CreateGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); return object; }; /** - * Converts this CreateGlossaryRequest to JSON. + * Converts this CreateGlossaryMetadata to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata * @instance * @returns {Object.} JSON object */ - CreateGlossaryRequest.prototype.toJSON = function toJSON() { + CreateGlossaryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateGlossaryRequest; + /** + * State enum. + * @name google.cloud.translation.v3.CreateGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + CreateGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CreateGlossaryMetadata; })(); - v3.GetGlossaryRequest = (function() { + v3.DeleteGlossaryMetadata = (function() { /** - * Properties of a GetGlossaryRequest. + * Properties of a DeleteGlossaryMetadata. * @memberof google.cloud.translation.v3 - * @interface IGetGlossaryRequest - * @property {string|null} [name] GetGlossaryRequest name + * @interface IDeleteGlossaryMetadata + * @property {string|null} [name] DeleteGlossaryMetadata name + * @property {google.cloud.translation.v3.DeleteGlossaryMetadata.State|null} [state] DeleteGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryMetadata submitTime */ /** - * Constructs a new GetGlossaryRequest. + * Constructs a new DeleteGlossaryMetadata. * @memberof google.cloud.translation.v3 - * @classdesc Represents a GetGlossaryRequest. - * @implements IGetGlossaryRequest + * @classdesc Represents a DeleteGlossaryMetadata. + * @implements IDeleteGlossaryMetadata * @constructor - * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set */ - function GetGlossaryRequest(properties) { + function DeleteGlossaryMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6188,76 +8820,102 @@ } /** - * GetGlossaryRequest name. - * @member {string} name - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * DeleteGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.name = ""; + + /** + * DeleteGlossaryMetadata state. + * @member {google.cloud.translation.v3.DeleteGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.state = 0; + + /** + * DeleteGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @instance */ - GetGlossaryRequest.prototype.name = ""; + DeleteGlossaryMetadata.prototype.submitTime = null; /** - * Creates a new GetGlossaryRequest instance using the specified properties. + * Creates a new DeleteGlossaryMetadata instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static - * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set - * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest instance + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata instance */ - GetGlossaryRequest.create = function create(properties) { - return new GetGlossaryRequest(properties); + DeleteGlossaryMetadata.create = function create(properties) { + return new DeleteGlossaryMetadata(properties); }; /** - * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static - * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetGlossaryRequest.encode = function encode(message, writer) { + DeleteGlossaryMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static - * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetGlossaryRequest.decode = function decode(reader, length) { + DeleteGlossaryMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; + case 2: + message.state = reader.int32(); + break; + case 3: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -6267,107 +8925,186 @@ }; /** - * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetGlossaryRequest message. + * Verifies a DeleteGlossaryMetadata message. * @function verify - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetGlossaryRequest.verify = function verify(message) { + DeleteGlossaryMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } return null; }; /** - * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata */ - GetGlossaryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.GetGlossaryRequest) + DeleteGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryMetadata) return object; - var message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + var message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); if (object.name != null) message.name = String(object.name); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } return message; }; /** - * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @static - * @param {google.cloud.translation.v3.GetGlossaryRequest} message GetGlossaryRequest + * @param {google.cloud.translation.v3.DeleteGlossaryMetadata} message DeleteGlossaryMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetGlossaryRequest.toObject = function toObject(message, options) { + DeleteGlossaryMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.DeleteGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); return object; }; /** - * Converts this GetGlossaryRequest to JSON. + * Converts this DeleteGlossaryMetadata to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata * @instance * @returns {Object.} JSON object */ - GetGlossaryRequest.prototype.toJSON = function toJSON() { + DeleteGlossaryMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetGlossaryRequest; + /** + * State enum. + * @name google.cloud.translation.v3.DeleteGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + DeleteGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return DeleteGlossaryMetadata; })(); - v3.DeleteGlossaryRequest = (function() { + v3.DeleteGlossaryResponse = (function() { /** - * Properties of a DeleteGlossaryRequest. + * Properties of a DeleteGlossaryResponse. * @memberof google.cloud.translation.v3 - * @interface IDeleteGlossaryRequest - * @property {string|null} [name] DeleteGlossaryRequest name + * @interface IDeleteGlossaryResponse + * @property {string|null} [name] DeleteGlossaryResponse name + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] DeleteGlossaryResponse endTime */ /** - * Constructs a new DeleteGlossaryRequest. + * Constructs a new DeleteGlossaryResponse. * @memberof google.cloud.translation.v3 - * @classdesc Represents a DeleteGlossaryRequest. - * @implements IDeleteGlossaryRequest + * @classdesc Represents a DeleteGlossaryResponse. + * @implements IDeleteGlossaryResponse * @constructor - * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set */ - function DeleteGlossaryRequest(properties) { + function DeleteGlossaryResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6375,76 +9112,102 @@ } /** - * DeleteGlossaryRequest name. + * DeleteGlossaryResponse name. * @member {string} name - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @instance */ - DeleteGlossaryRequest.prototype.name = ""; + DeleteGlossaryResponse.prototype.name = ""; /** - * Creates a new DeleteGlossaryRequest instance using the specified properties. + * DeleteGlossaryResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.submitTime = null; + + /** + * DeleteGlossaryResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.endTime = null; + + /** + * Creates a new DeleteGlossaryResponse instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set - * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest instance + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse instance */ - DeleteGlossaryRequest.create = function create(properties) { - return new DeleteGlossaryRequest(properties); + DeleteGlossaryResponse.create = function create(properties) { + return new DeleteGlossaryResponse(properties); }; /** - * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryRequest.encode = function encode(message, writer) { + DeleteGlossaryResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteGlossaryResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryRequest.decode = function decode(reader, length) { + DeleteGlossaryResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; + case 2: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -6454,110 +9217,146 @@ }; /** - * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteGlossaryResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteGlossaryRequest message. + * Verifies a DeleteGlossaryResponse message. * @function verify - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteGlossaryRequest.verify = function verify(message) { + DeleteGlossaryResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } return null; }; /** - * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse */ - DeleteGlossaryRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryRequest) + DeleteGlossaryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryResponse) return object; - var message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + var message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); if (object.name != null) message.name = String(object.name); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } return message; }; /** - * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @static - * @param {google.cloud.translation.v3.DeleteGlossaryRequest} message DeleteGlossaryRequest + * @param {google.cloud.translation.v3.DeleteGlossaryResponse} message DeleteGlossaryResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteGlossaryRequest.toObject = function toObject(message, options) { + DeleteGlossaryResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.submitTime = null; + object.endTime = null; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this DeleteGlossaryRequest to JSON. + * Converts this DeleteGlossaryResponse to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse * @instance * @returns {Object.} JSON object */ - DeleteGlossaryRequest.prototype.toJSON = function toJSON() { + DeleteGlossaryResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteGlossaryRequest; + return DeleteGlossaryResponse; })(); - v3.ListGlossariesRequest = (function() { + v3.BatchTranslateDocumentRequest = (function() { /** - * Properties of a ListGlossariesRequest. + * Properties of a BatchTranslateDocumentRequest. * @memberof google.cloud.translation.v3 - * @interface IListGlossariesRequest - * @property {string|null} [parent] ListGlossariesRequest parent - * @property {number|null} [pageSize] ListGlossariesRequest pageSize - * @property {string|null} [pageToken] ListGlossariesRequest pageToken - * @property {string|null} [filter] ListGlossariesRequest filter + * @interface IBatchTranslateDocumentRequest + * @property {string|null} [parent] BatchTranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateDocumentRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateDocumentRequest targetLanguageCodes + * @property {Array.|null} [inputConfigs] BatchTranslateDocumentRequest inputConfigs + * @property {google.cloud.translation.v3.IBatchDocumentOutputConfig|null} [outputConfig] BatchTranslateDocumentRequest outputConfig + * @property {Object.|null} [models] BatchTranslateDocumentRequest models + * @property {Object.|null} [glossaries] BatchTranslateDocumentRequest glossaries + * @property {Object.|null} [formatConversions] BatchTranslateDocumentRequest formatConversions */ /** - * Constructs a new ListGlossariesRequest. + * Constructs a new BatchTranslateDocumentRequest. * @memberof google.cloud.translation.v3 - * @classdesc Represents a ListGlossariesRequest. - * @implements IListGlossariesRequest + * @classdesc Represents a BatchTranslateDocumentRequest. + * @implements IBatchTranslateDocumentRequest * @constructor - * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest=} [properties] Properties to set */ - function ListGlossariesRequest(properties) { + function BatchTranslateDocumentRequest(properties) { + this.targetLanguageCodes = []; + this.inputConfigs = []; + this.models = {}; + this.glossaries = {}; + this.formatConversions = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6565,100 +9364,147 @@ } /** - * ListGlossariesRequest parent. + * BatchTranslateDocumentRequest parent. * @member {string} parent - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @instance */ - ListGlossariesRequest.prototype.parent = ""; + BatchTranslateDocumentRequest.prototype.parent = ""; /** - * ListGlossariesRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * BatchTranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @instance */ - ListGlossariesRequest.prototype.pageSize = 0; + BatchTranslateDocumentRequest.prototype.sourceLanguageCode = ""; /** - * ListGlossariesRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * BatchTranslateDocumentRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @instance */ - ListGlossariesRequest.prototype.pageToken = ""; + BatchTranslateDocumentRequest.prototype.targetLanguageCodes = $util.emptyArray; /** - * ListGlossariesRequest filter. - * @member {string} filter - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * BatchTranslateDocumentRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @instance */ - ListGlossariesRequest.prototype.filter = ""; + BatchTranslateDocumentRequest.prototype.inputConfigs = $util.emptyArray; /** - * Creates a new ListGlossariesRequest instance using the specified properties. + * BatchTranslateDocumentRequest outputConfig. + * @member {google.cloud.translation.v3.IBatchDocumentOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.outputConfig = null; + + /** + * BatchTranslateDocumentRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest formatConversions. + * @member {Object.} formatConversions + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.formatConversions = $util.emptyObject; + + /** + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set - * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest instance */ - ListGlossariesRequest.create = function create(properties) { - return new ListGlossariesRequest(properties); + BatchTranslateDocumentRequest.create = function create(properties) { + return new BatchTranslateDocumentRequest(properties); }; /** - * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListGlossariesRequest.encode = function encode(message, writer) { + BatchTranslateDocumentRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3.BatchDocumentInputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3.BatchDocumentOutputConfig.encode(message.outputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.formatConversions != null && Object.hasOwnProperty.call(message, "formatConversions")) + for (var keys = Object.keys(message.formatConversions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.formatConversions[keys[i]]).ldelim(); return writer; }; /** - * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListGlossariesRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchTranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGlossariesRequest.decode = function decode(reader, length) { + BatchTranslateDocumentRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentRequest(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -6666,13 +9512,86 @@ message.parent = reader.string(); break; case 2: - message.pageSize = reader.int32(); + message.sourceLanguageCode = reader.string(); break; case 3: - message.pageToken = reader.string(); + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + case 4: + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3.BatchDocumentInputConfig.decode(reader, reader.uint32())); + break; + case 5: + message.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.decode(reader, reader.uint32()); + break; + case 6: + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + case 7: + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; break; - case 4: - message.filter = reader.string(); + case 8: + if (message.formatConversions === $util.emptyObject) + message.formatConversions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.formatConversions[key] = value; break; default: reader.skipType(tag & 7); @@ -6683,134 +9602,247 @@ }; /** - * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGlossariesRequest.decodeDelimited = function decodeDelimited(reader) { + BatchTranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListGlossariesRequest message. + * Verifies a BatchTranslateDocumentRequest message. * @function verify - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGlossariesRequest.verify = function verify(message) { + BatchTranslateDocumentRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: string[] expected"; + } + if (message.inputConfigs != null && message.hasOwnProperty("inputConfigs")) { + if (!Array.isArray(message.inputConfigs)) + return "inputConfigs: array expected"; + for (var i = 0; i < message.inputConfigs.length; ++i) { + var error = $root.google.cloud.translation.v3.BatchDocumentInputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k:string} expected"; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.formatConversions != null && message.hasOwnProperty("formatConversions")) { + if (!$util.isObject(message.formatConversions)) + return "formatConversions: object expected"; + var key = Object.keys(message.formatConversions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.formatConversions[key[i]])) + return "formatConversions: string{k:string} expected"; + } return null; }; /** - * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest */ - ListGlossariesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.ListGlossariesRequest) + BatchTranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentRequest) return object; - var message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentRequest(); if (object.parent != null) message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3.BatchDocumentInputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.fromObject(object.outputConfig); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.formatConversions) { + if (typeof object.formatConversions !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.formatConversions: object expected"); + message.formatConversions = {}; + for (var keys = Object.keys(object.formatConversions), i = 0; i < keys.length; ++i) + message.formatConversions[keys[i]] = String(object.formatConversions[keys[i]]); + } return message; }; /** - * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @static - * @param {google.cloud.translation.v3.ListGlossariesRequest} message ListGlossariesRequest + * @param {google.cloud.translation.v3.BatchTranslateDocumentRequest} message BatchTranslateDocumentRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListGlossariesRequest.toObject = function toObject(message, options) { + BatchTranslateDocumentRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.formatConversions = {}; + } if (options.defaults) { object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3.BatchDocumentInputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.toObject(message.outputConfig, options); + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.formatConversions && (keys2 = Object.keys(message.formatConversions)).length) { + object.formatConversions = {}; + for (var j = 0; j < keys2.length; ++j) + object.formatConversions[keys2[j]] = message.formatConversions[keys2[j]]; + } return object; }; /** - * Converts this ListGlossariesRequest to JSON. + * Converts this BatchTranslateDocumentRequest to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest * @instance * @returns {Object.} JSON object */ - ListGlossariesRequest.prototype.toJSON = function toJSON() { + BatchTranslateDocumentRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListGlossariesRequest; + return BatchTranslateDocumentRequest; })(); - v3.ListGlossariesResponse = (function() { + v3.BatchDocumentInputConfig = (function() { /** - * Properties of a ListGlossariesResponse. + * Properties of a BatchDocumentInputConfig. * @memberof google.cloud.translation.v3 - * @interface IListGlossariesResponse - * @property {Array.|null} [glossaries] ListGlossariesResponse glossaries - * @property {string|null} [nextPageToken] ListGlossariesResponse nextPageToken + * @interface IBatchDocumentInputConfig + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] BatchDocumentInputConfig gcsSource */ /** - * Constructs a new ListGlossariesResponse. + * Constructs a new BatchDocumentInputConfig. * @memberof google.cloud.translation.v3 - * @classdesc Represents a ListGlossariesResponse. - * @implements IListGlossariesResponse + * @classdesc Represents a BatchDocumentInputConfig. + * @implements IBatchDocumentInputConfig * @constructor - * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig=} [properties] Properties to set */ - function ListGlossariesResponse(properties) { - this.glossaries = []; + function BatchDocumentInputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6818,91 +9850,89 @@ } /** - * ListGlossariesResponse glossaries. - * @member {Array.} glossaries - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * BatchDocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @instance */ - ListGlossariesResponse.prototype.glossaries = $util.emptyArray; + BatchDocumentInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * ListGlossariesResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * BatchDocumentInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @instance */ - ListGlossariesResponse.prototype.nextPageToken = ""; + Object.defineProperty(BatchDocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new ListGlossariesResponse instance using the specified properties. + * Creates a new BatchDocumentInputConfig instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static - * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set - * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse instance + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig instance */ - ListGlossariesResponse.create = function create(properties) { - return new ListGlossariesResponse(properties); + BatchDocumentInputConfig.create = function create(properties) { + return new BatchDocumentInputConfig(properties); }; /** - * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static - * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListGlossariesResponse.encode = function encode(message, writer) { + BatchDocumentInputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.glossaries != null && message.glossaries.length) - for (var i = 0; i < message.glossaries.length; ++i) - $root.google.cloud.translation.v3.Glossary.encode(message.glossaries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static - * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListGlossariesResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchDocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGlossariesResponse.decode = function decode(reader, length) { + BatchDocumentInputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchDocumentInputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.glossaries && message.glossaries.length)) - message.glossaries = []; - message.glossaries.push($root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -6913,135 +9943,117 @@ }; /** - * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGlossariesResponse.decodeDelimited = function decodeDelimited(reader) { + BatchDocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListGlossariesResponse message. + * Verifies a BatchDocumentInputConfig message. * @function verify - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGlossariesResponse.verify = function verify(message) { + BatchDocumentInputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.glossaries != null && message.hasOwnProperty("glossaries")) { - if (!Array.isArray(message.glossaries)) - return "glossaries: array expected"; - for (var i = 0; i < message.glossaries.length; ++i) { - var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossaries[i]); + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.translation.v3.GcsSource.verify(message.gcsSource); if (error) - return "glossaries." + error; + return "gcsSource." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; return null; }; /** - * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig */ - ListGlossariesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.ListGlossariesResponse) + BatchDocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchDocumentInputConfig) return object; - var message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); - if (object.glossaries) { - if (!Array.isArray(object.glossaries)) - throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: array expected"); - message.glossaries = []; - for (var i = 0; i < object.glossaries.length; ++i) { - if (typeof object.glossaries[i] !== "object") - throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: object expected"); - message.glossaries[i] = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossaries[i]); - } + var message = new $root.google.cloud.translation.v3.BatchDocumentInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.BatchDocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @static - * @param {google.cloud.translation.v3.ListGlossariesResponse} message ListGlossariesResponse + * @param {google.cloud.translation.v3.BatchDocumentInputConfig} message BatchDocumentInputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListGlossariesResponse.toObject = function toObject(message, options) { + BatchDocumentInputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.glossaries = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.glossaries && message.glossaries.length) { - object.glossaries = []; - for (var j = 0; j < message.glossaries.length; ++j) - object.glossaries[j] = $root.google.cloud.translation.v3.Glossary.toObject(message.glossaries[j], options); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this ListGlossariesResponse to JSON. + * Converts this BatchDocumentInputConfig to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig * @instance * @returns {Object.} JSON object */ - ListGlossariesResponse.prototype.toJSON = function toJSON() { + BatchDocumentInputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListGlossariesResponse; + return BatchDocumentInputConfig; })(); - v3.CreateGlossaryMetadata = (function() { + v3.BatchDocumentOutputConfig = (function() { /** - * Properties of a CreateGlossaryMetadata. + * Properties of a BatchDocumentOutputConfig. * @memberof google.cloud.translation.v3 - * @interface ICreateGlossaryMetadata - * @property {string|null} [name] CreateGlossaryMetadata name - * @property {google.cloud.translation.v3.CreateGlossaryMetadata.State|null} [state] CreateGlossaryMetadata state - * @property {google.protobuf.ITimestamp|null} [submitTime] CreateGlossaryMetadata submitTime + * @interface IBatchDocumentOutputConfig + * @property {google.cloud.translation.v3.IGcsDestination|null} [gcsDestination] BatchDocumentOutputConfig gcsDestination */ /** - * Constructs a new CreateGlossaryMetadata. + * Constructs a new BatchDocumentOutputConfig. * @memberof google.cloud.translation.v3 - * @classdesc Represents a CreateGlossaryMetadata. - * @implements ICreateGlossaryMetadata + * @classdesc Represents a BatchDocumentOutputConfig. + * @implements IBatchDocumentOutputConfig * @constructor - * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig=} [properties] Properties to set */ - function CreateGlossaryMetadata(properties) { + function BatchDocumentOutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7049,101 +10061,89 @@ } /** - * CreateGlossaryMetadata name. - * @member {string} name - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * BatchDocumentOutputConfig gcsDestination. + * @member {google.cloud.translation.v3.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @instance */ - CreateGlossaryMetadata.prototype.name = ""; + BatchDocumentOutputConfig.prototype.gcsDestination = null; - /** - * CreateGlossaryMetadata state. - * @member {google.cloud.translation.v3.CreateGlossaryMetadata.State} state - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata - * @instance - */ - CreateGlossaryMetadata.prototype.state = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * CreateGlossaryMetadata submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * BatchDocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @instance */ - CreateGlossaryMetadata.prototype.submitTime = null; + Object.defineProperty(BatchDocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new CreateGlossaryMetadata instance using the specified properties. + * Creates a new BatchDocumentOutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static - * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set - * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata instance + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig instance */ - CreateGlossaryMetadata.create = function create(properties) { - return new CreateGlossaryMetadata(properties); + BatchDocumentOutputConfig.create = function create(properties) { + return new BatchDocumentOutputConfig(properties); }; /** - * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static - * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateGlossaryMetadata.encode = function encode(message, writer) { + BatchDocumentOutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static - * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + BatchDocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateGlossaryMetadata.decode = function decode(reader, length) { + BatchDocumentOutputConfig.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchDocumentOutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); - break; - case 2: - message.state = reader.int32(); - break; - case 3: - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7154,186 +10154,126 @@ }; /** - * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + BatchDocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateGlossaryMetadata message. + * Verifies a BatchDocumentOutputConfig message. * @function verify - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateGlossaryMetadata.verify = function verify(message) { + BatchDocumentOutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; + var properties = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.translation.v3.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; } - if (message.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); - if (error) - return "submitTime." + error; } return null; }; /** - * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig */ - CreateGlossaryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryMetadata) + BatchDocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchDocumentOutputConfig) return object; - var message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); - if (object.name != null) - message.name = String(object.name); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "SUCCEEDED": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLING": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.CreateGlossaryMetadata.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + var message = new $root.google.cloud.translation.v3.BatchDocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3.BatchDocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.fromObject(object.gcsDestination); } return message; }; /** - * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @static - * @param {google.cloud.translation.v3.CreateGlossaryMetadata} message CreateGlossaryMetadata + * @param {google.cloud.translation.v3.BatchDocumentOutputConfig} message BatchDocumentOutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateGlossaryMetadata.toObject = function toObject(message, options) { + BatchDocumentOutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.name = ""; - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.submitTime = null; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.translation.v3.CreateGlossaryMetadata.State[message.state] : message.state; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); return object; }; /** - * Converts this CreateGlossaryMetadata to JSON. + * Converts this BatchDocumentOutputConfig to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig * @instance * @returns {Object.} JSON object */ - CreateGlossaryMetadata.prototype.toJSON = function toJSON() { + BatchDocumentOutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.translation.v3.CreateGlossaryMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} SUCCEEDED=2 SUCCEEDED value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLING=4 CANCELLING value - * @property {number} CANCELLED=5 CANCELLED value - */ - CreateGlossaryMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "SUCCEEDED"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLING"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); - - return CreateGlossaryMetadata; + return BatchDocumentOutputConfig; })(); - v3.DeleteGlossaryMetadata = (function() { + v3.BatchTranslateDocumentResponse = (function() { /** - * Properties of a DeleteGlossaryMetadata. + * Properties of a BatchTranslateDocumentResponse. * @memberof google.cloud.translation.v3 - * @interface IDeleteGlossaryMetadata - * @property {string|null} [name] DeleteGlossaryMetadata name - * @property {google.cloud.translation.v3.DeleteGlossaryMetadata.State|null} [state] DeleteGlossaryMetadata state - * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryMetadata submitTime + * @interface IBatchTranslateDocumentResponse + * @property {number|Long|null} [totalPages] BatchTranslateDocumentResponse totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentResponse translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentResponse failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentResponse totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentResponse failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentResponse totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateDocumentResponse endTime */ /** - * Constructs a new DeleteGlossaryMetadata. + * Constructs a new BatchTranslateDocumentResponse. * @memberof google.cloud.translation.v3 - * @classdesc Represents a DeleteGlossaryMetadata. - * @implements IDeleteGlossaryMetadata + * @classdesc Represents a BatchTranslateDocumentResponse. + * @implements IBatchTranslateDocumentResponse * @constructor - * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse=} [properties] Properties to set */ - function DeleteGlossaryMetadata(properties) { + function BatchTranslateDocumentResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7341,102 +10281,193 @@ } /** - * DeleteGlossaryMetadata name. - * @member {string} name - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * BatchTranslateDocumentResponse totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @instance */ - DeleteGlossaryMetadata.prototype.name = ""; + BatchTranslateDocumentResponse.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * DeleteGlossaryMetadata state. - * @member {google.cloud.translation.v3.DeleteGlossaryMetadata.State} state - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * BatchTranslateDocumentResponse translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @instance */ - DeleteGlossaryMetadata.prototype.state = 0; + BatchTranslateDocumentResponse.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * DeleteGlossaryMetadata submitTime. + * BatchTranslateDocumentResponse failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse submitTime. * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @instance */ - DeleteGlossaryMetadata.prototype.submitTime = null; + BatchTranslateDocumentResponse.prototype.submitTime = null; /** - * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * BatchTranslateDocumentResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set - * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse instance */ - DeleteGlossaryMetadata.create = function create(properties) { - return new DeleteGlossaryMetadata(properties); + BatchTranslateDocumentResponse.create = function create(properties) { + return new BatchTranslateDocumentResponse(properties); }; /** - * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryMetadata.encode = function encode(message, writer) { + BatchTranslateDocumentResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.totalBillableCharacters); if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; /** - * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + BatchTranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryMetadata.decode = function decode(reader, length) { + BatchTranslateDocumentResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.totalPages = reader.int64(); break; case 2: - message.state = reader.int32(); + message.translatedPages = reader.int64(); break; case 3: + message.failedPages = reader.int64(); + break; + case 4: + message.totalBillablePages = reader.int64(); + break; + case 5: + message.totalCharacters = reader.int64(); + break; + case 6: + message.translatedCharacters = reader.int64(); + break; + case 7: + message.failedCharacters = reader.int64(); + break; + case 8: + message.totalBillableCharacters = reader.int64(); + break; + case 9: message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; + case 10: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -7446,186 +10477,311 @@ }; /** - * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + BatchTranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteGlossaryMetadata message. + * Verifies a BatchTranslateDocumentResponse message. * @function verify - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteGlossaryMetadata.verify = function verify(message) { + BatchTranslateDocumentResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; if (message.submitTime != null && message.hasOwnProperty("submitTime")) { var error = $root.google.protobuf.Timestamp.verify(message.submitTime); if (error) return "submitTime." + error; } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } return null; }; /** - * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse */ - DeleteGlossaryMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryMetadata) + BatchTranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentResponse) return object; - var message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); - if (object.name != null) - message.name = String(object.name); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "SUCCEEDED": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLING": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentResponse(); + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); if (object.submitTime != null) { if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.DeleteGlossaryMetadata.submitTime: object expected"); + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentResponse.submitTime: object expected"); message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } return message; }; /** - * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @static - * @param {google.cloud.translation.v3.DeleteGlossaryMetadata} message DeleteGlossaryMetadata + * @param {google.cloud.translation.v3.BatchTranslateDocumentResponse} message BatchTranslateDocumentResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteGlossaryMetadata.toObject = function toObject(message, options) { + BatchTranslateDocumentResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; object.submitTime = null; + object.endTime = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.translation.v3.DeleteGlossaryMetadata.State[message.state] : message.state; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; if (message.submitTime != null && message.hasOwnProperty("submitTime")) object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this DeleteGlossaryMetadata to JSON. + * Converts this BatchTranslateDocumentResponse to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse * @instance * @returns {Object.} JSON object */ - DeleteGlossaryMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * State enum. - * @name google.cloud.translation.v3.DeleteGlossaryMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} SUCCEEDED=2 SUCCEEDED value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLING=4 CANCELLING value - * @property {number} CANCELLED=5 CANCELLED value - */ - DeleteGlossaryMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "SUCCEEDED"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLING"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; - })(); + BatchTranslateDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return DeleteGlossaryMetadata; + return BatchTranslateDocumentResponse; })(); - v3.DeleteGlossaryResponse = (function() { + v3.BatchTranslateDocumentMetadata = (function() { /** - * Properties of a DeleteGlossaryResponse. + * Properties of a BatchTranslateDocumentMetadata. * @memberof google.cloud.translation.v3 - * @interface IDeleteGlossaryResponse - * @property {string|null} [name] DeleteGlossaryResponse name - * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryResponse submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] DeleteGlossaryResponse endTime + * @interface IBatchTranslateDocumentMetadata + * @property {google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|null} [state] BatchTranslateDocumentMetadata state + * @property {number|Long|null} [totalPages] BatchTranslateDocumentMetadata totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentMetadata translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentMetadata failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentMetadata totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentMetadata totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentMetadata failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentMetadata totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentMetadata submitTime */ /** - * Constructs a new DeleteGlossaryResponse. + * Constructs a new BatchTranslateDocumentMetadata. * @memberof google.cloud.translation.v3 - * @classdesc Represents a DeleteGlossaryResponse. - * @implements IDeleteGlossaryResponse + * @classdesc Represents a BatchTranslateDocumentMetadata. + * @implements IBatchTranslateDocumentMetadata * @constructor - * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata=} [properties] Properties to set */ - function DeleteGlossaryResponse(properties) { + function BatchTranslateDocumentMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7633,101 +10789,192 @@ } /** - * DeleteGlossaryResponse name. - * @member {string} name - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * BatchTranslateDocumentMetadata state. + * @member {google.cloud.translation.v3.BatchTranslateDocumentMetadata.State} state + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @instance */ - DeleteGlossaryResponse.prototype.name = ""; + BatchTranslateDocumentMetadata.prototype.state = 0; /** - * DeleteGlossaryResponse submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * BatchTranslateDocumentMetadata totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @instance */ - DeleteGlossaryResponse.prototype.submitTime = null; + BatchTranslateDocumentMetadata.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * DeleteGlossaryResponse endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * BatchTranslateDocumentMetadata translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @instance */ - DeleteGlossaryResponse.prototype.endTime = null; + BatchTranslateDocumentMetadata.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * Creates a new DeleteGlossaryResponse instance using the specified properties. + * BatchTranslateDocumentMetadata failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. * @function create - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set - * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata instance */ - DeleteGlossaryResponse.create = function create(properties) { - return new DeleteGlossaryResponse(properties); + BatchTranslateDocumentMetadata.create = function create(properties) { + return new BatchTranslateDocumentMetadata(properties); }; /** - * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryResponse.encode = function encode(message, writer) { + BatchTranslateDocumentMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.totalBillableCharacters); if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; /** - * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static - * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteGlossaryResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchTranslateDocumentMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryResponse.decode = function decode(reader, length) { + BatchTranslateDocumentMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.state = reader.int32(); break; case 2: - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.totalPages = reader.int64(); break; case 3: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.translatedPages = reader.int64(); + break; + case 4: + message.failedPages = reader.int64(); + break; + case 5: + message.totalBillablePages = reader.int64(); + break; + case 6: + message.totalCharacters = reader.int64(); + break; + case 7: + message.translatedCharacters = reader.int64(); + break; + case 8: + message.failedCharacters = reader.int64(); + break; + case 9: + message.totalBillableCharacters = reader.int64(); + break; + case 10: + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7738,114 +10985,332 @@ }; /** - * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGlossaryResponse.decodeDelimited = function decodeDelimited(reader) { + BatchTranslateDocumentMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteGlossaryResponse message. + * Verifies a BatchTranslateDocumentMetadata message. * @function verify - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteGlossaryResponse.verify = function verify(message) { + BatchTranslateDocumentMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; if (message.submitTime != null && message.hasOwnProperty("submitTime")) { var error = $root.google.protobuf.Timestamp.verify(message.submitTime); if (error) return "submitTime." + error; } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; + return null; + }; + + /** + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + */ + BatchTranslateDocumentMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; } - return null; - }; - - /** - * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse - */ - DeleteGlossaryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryResponse) - return object; - var message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); - if (object.name != null) - message.name = String(object.name); + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); if (object.submitTime != null) { if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.submitTime: object expected"); + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentMetadata.submitTime: object expected"); message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } return message; }; /** - * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @static - * @param {google.cloud.translation.v3.DeleteGlossaryResponse} message DeleteGlossaryResponse + * @param {google.cloud.translation.v3.BatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteGlossaryResponse.toObject = function toObject(message, options) { + BatchTranslateDocumentMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; object.submitTime = null; - object.endTime = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata.State[message.state] : message.state; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; if (message.submitTime != null && message.hasOwnProperty("submitTime")) object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); return object; }; /** - * Converts this DeleteGlossaryResponse to JSON. + * Converts this BatchTranslateDocumentMetadata to JSON. * @function toJSON - * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata * @instance * @returns {Object.} JSON object */ - DeleteGlossaryResponse.prototype.toJSON = function toJSON() { + BatchTranslateDocumentMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteGlossaryResponse; + /** + * State enum. + * @name google.cloud.translation.v3.BatchTranslateDocumentMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateDocumentMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateDocumentMetadata; })(); return v3; @@ -17134,6 +20599,7 @@ * @property {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig|null} [outputConfig] BatchTranslateDocumentRequest outputConfig * @property {Object.|null} [models] BatchTranslateDocumentRequest models * @property {Object.|null} [glossaries] BatchTranslateDocumentRequest glossaries + * @property {Object.|null} [formatConversions] BatchTranslateDocumentRequest formatConversions */ /** @@ -17149,6 +20615,7 @@ this.inputConfigs = []; this.models = {}; this.glossaries = {}; + this.formatConversions = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17211,6 +20678,14 @@ */ BatchTranslateDocumentRequest.prototype.glossaries = $util.emptyObject; + /** + * BatchTranslateDocumentRequest formatConversions. + * @member {Object.} formatConversions + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.formatConversions = $util.emptyObject; + /** * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @function create @@ -17255,6 +20730,9 @@ writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } + if (message.formatConversions != null && Object.hasOwnProperty.call(message, "formatConversions")) + for (var keys = Object.keys(message.formatConversions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.formatConversions[keys[i]]).ldelim(); return writer; }; @@ -17352,6 +20830,28 @@ } message.glossaries[key] = value; break; + case 8: + if (message.formatConversions === $util.emptyObject) + message.formatConversions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.formatConversions[key] = value; + break; default: reader.skipType(tag & 7); break; @@ -17432,6 +20932,14 @@ return "glossaries." + error; } } + if (message.formatConversions != null && message.hasOwnProperty("formatConversions")) { + if (!$util.isObject(message.formatConversions)) + return "formatConversions: object expected"; + var key = Object.keys(message.formatConversions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.formatConversions[key[i]])) + return "formatConversions: string{k:string} expected"; + } return null; }; @@ -17490,6 +20998,13 @@ message.glossaries[keys[i]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); } } + if (object.formatConversions) { + if (typeof object.formatConversions !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.formatConversions: object expected"); + message.formatConversions = {}; + for (var keys = Object.keys(object.formatConversions), i = 0; i < keys.length; ++i) + message.formatConversions[keys[i]] = String(object.formatConversions[keys[i]]); + } return message; }; @@ -17513,6 +21028,7 @@ if (options.objects || options.defaults) { object.models = {}; object.glossaries = {}; + object.formatConversions = {}; } if (options.defaults) { object.parent = ""; @@ -17546,6 +21062,11 @@ for (var j = 0; j < keys2.length; ++j) object.glossaries[keys2[j]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); } + if (message.formatConversions && (keys2 = Object.keys(message.formatConversions)).length) { + object.formatConversions = {}; + for (var j = 0; j < keys2.length; ++j) + object.formatConversions[keys2[j]] = message.formatConversions[keys2[j]]; + } return object; }; diff --git a/protos/protos.json b/protos/protos.json index 965ef085..d6b2f59e 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -101,6 +101,22 @@ } ] }, + "TranslateDocument": { + "requestType": "TranslateDocumentRequest", + "responseType": "TranslateDocumentResponse", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:translateDocument", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:translateDocument", + "body": "*" + } + } + ] + }, "BatchTranslateText": { "requestType": "BatchTranslateTextRequest", "responseType": "google.longrunning.Operation", @@ -125,6 +141,30 @@ } ] }, + "BatchTranslateDocument": { + "requestType": "BatchTranslateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:batchTranslateDocument", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "BatchTranslateDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "BatchTranslateDocumentMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:batchTranslateDocument", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchTranslateDocumentResponse", + "metadata_type": "BatchTranslateDocumentMetadata" + } + } + ] + }, "CreateGlossary": { "requestType": "CreateGlossaryRequest", "responseType": "google.longrunning.Operation", @@ -457,7 +497,10 @@ "fields": { "inputUri": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -487,7 +530,10 @@ "fields": { "outputUriPrefix": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, @@ -506,6 +552,153 @@ } } }, + "DocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "content", + "gcsSource" + ] + } + }, + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 4 + } + } + }, + "DocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetLanguageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentInputConfig": { + "type": "DocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "model": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DocumentTranslation": { + "fields": { + "byteStreamOutputs": { + "rule": "repeated", + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + }, + "detectedLanguageCode": { + "type": "string", + "id": 3 + } + } + }, + "TranslateDocumentResponse": { + "fields": { + "documentTranslation": { + "type": "DocumentTranslation", + "id": 1 + }, + "glossaryDocumentTranslation": { + "type": "DocumentTranslation", + "id": 2 + }, + "model": { + "type": "string", + "id": 3 + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 4 + } + } + }, "BatchTranslateTextRequest": { "fields": { "parent": { @@ -663,7 +856,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } }, "languagePair": { "type": "LanguageCodePair", @@ -883,6 +1079,202 @@ "id": 3 } } + }, + "BatchTranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "BatchDocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "BatchDocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "models": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaries": { + "keyType": "string", + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "formatConversions": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchDocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + } + } + }, + "BatchDocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "BatchTranslateDocumentResponse": { + "fields": { + "totalPages": { + "type": "int64", + "id": 1 + }, + "translatedPages": { + "type": "int64", + "id": 2 + }, + "failedPages": { + "type": "int64", + "id": 3 + }, + "totalBillablePages": { + "type": "int64", + "id": 4 + }, + "totalCharacters": { + "type": "int64", + "id": 5 + }, + "translatedCharacters": { + "type": "int64", + "id": 6 + }, + "failedCharacters": { + "type": "int64", + "id": 7 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 8 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + } + }, + "BatchTranslateDocumentMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "totalPages": { + "type": "int64", + "id": 2 + }, + "translatedPages": { + "type": "int64", + "id": 3 + }, + "failedPages": { + "type": "int64", + "id": 4 + }, + "totalBillablePages": { + "type": "int64", + "id": 5 + }, + "totalCharacters": { + "type": "int64", + "id": 6 + }, + "translatedCharacters": { + "type": "int64", + "id": 7 + }, + "failedCharacters": { + "type": "int64", + "id": 8 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 9 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } } } }, @@ -2008,6 +2400,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "formatConversions": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, diff --git a/src/v3/gapic_metadata.json b/src/v3/gapic_metadata.json index 54b01faa..6af9328f 100644 --- a/src/v3/gapic_metadata.json +++ b/src/v3/gapic_metadata.json @@ -25,6 +25,11 @@ "getSupportedLanguages" ] }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, "GetGlossary": { "methods": [ "getGlossary" @@ -35,6 +40,11 @@ "batchTranslateText" ] }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, "CreateGlossary": { "methods": [ "createGlossary" @@ -72,6 +82,11 @@ "getSupportedLanguages" ] }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, "GetGlossary": { "methods": [ "getGlossary" @@ -82,6 +97,11 @@ "batchTranslateText" ] }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, "CreateGlossary": { "methods": [ "createGlossary" diff --git a/src/v3/translation_service_client.ts b/src/v3/translation_service_client.ts index a630052c..477be829 100644 --- a/src/v3/translation_service_client.ts +++ b/src/v3/translation_service_client.ts @@ -203,6 +203,12 @@ export class TranslationServiceClient { const batchTranslateTextMetadata = protoFilesRoot.lookup( '.google.cloud.translation.v3.BatchTranslateMetadata' ) as gax.protobuf.Type; + const batchTranslateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateDocumentResponse' + ) as gax.protobuf.Type; + const batchTranslateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateDocumentMetadata' + ) as gax.protobuf.Type; const createGlossaryResponse = protoFilesRoot.lookup( '.google.cloud.translation.v3.Glossary' ) as gax.protobuf.Type; @@ -222,6 +228,15 @@ export class TranslationServiceClient { batchTranslateTextResponse.decode.bind(batchTranslateTextResponse), batchTranslateTextMetadata.decode.bind(batchTranslateTextMetadata) ), + batchTranslateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchTranslateDocumentResponse.decode.bind( + batchTranslateDocumentResponse + ), + batchTranslateDocumentMetadata.decode.bind( + batchTranslateDocumentMetadata + ) + ), createGlossary: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createGlossaryResponse.decode.bind(createGlossaryResponse), @@ -287,7 +302,9 @@ export class TranslationServiceClient { 'translateText', 'detectLanguage', 'getSupportedLanguages', + 'translateDocument', 'batchTranslateText', + 'batchTranslateDocument', 'createGlossary', 'listGlossaries', 'getGlossary', @@ -418,7 +435,8 @@ export class TranslationServiceClient { * The request object that will be sent. * @param {string[]} request.contents * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. + * We recommend the total content be less than 30k codepoints. The max length + * of this field is 1024. * Use BatchTranslateText for larger text. * @param {string} [request.mimeType] * Optional. The format of the source text, for example, "text/html", @@ -457,14 +475,13 @@ export class TranslationServiceClient { * * - General (built-in) models: * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` * * * For global (non-regionalized) requests, use `location-id` `global`. * For example, * `projects/{project-number-or-id}/locations/global/models/general/nmt`. * - * If missing, the system decides which google base model to use. + * If not provided, the default Google model (NMT) will be used. * @param {google.cloud.translation.v3.TranslateTextGlossaryConfig} [request.glossaryConfig] * Optional. Glossary to be applied. The glossary must be * within the same region (have the same location-id) as the model, otherwise @@ -477,7 +494,8 @@ export class TranslationServiceClient { * 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/labels for more information. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -602,7 +620,8 @@ export class TranslationServiceClient { * 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/labels for more information. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -723,11 +742,10 @@ export class TranslationServiceClient { * * - General (built-in) models: * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` * * * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general base (PBMT) model. + * If missing, we get supported languages of Google general NMT model. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -784,6 +802,154 @@ export class TranslationServiceClient { this.initialize(); return this.innerApiCalls.getSupportedLanguages(request, options, callback); } + translateDocument( + request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + protos.google.cloud.translation.v3.ITranslateDocumentRequest | undefined, + {} | undefined + ] + >; + translateDocument( + request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateDocument( + request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Translates documents in synchronous mode. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. 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. + * @param {string} [request.sourceLanguageCode] + * Optional. The BCP-47 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. + * @param {string} request.targetLanguageCode + * Required. The BCP-47 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @param {google.cloud.translation.v3.DocumentInputConfig} request.documentInputConfig + * Required. Input configurations. + * @param {google.cloud.translation.v3.DocumentOutputConfig} [request.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. + * @param {string} [request.model] + * Optional. 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. + * @param {google.cloud.translation.v3.TranslateTextGlossaryConfig} [request.glossaryConfig] + * 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. + * @param {number[]} [request.labels] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TranslateDocumentResponse]{@link google.cloud.translation.v3.TranslateDocumentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.translateDocument(request); + */ + translateDocument( + request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + protos.google.cloud.translation.v3.ITranslateDocumentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.translateDocument(request, options, callback); + } getGlossary( request?: protos.google.cloud.translation.v3.IGetGlossaryRequest, options?: CallOptions @@ -944,14 +1110,13 @@ export class TranslationServiceClient { * * - General (built-in) models: * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` * * * If the map is empty or a specific model is * not requested for a language pair, then default google model (nmt) is used. * @param {number[]} request.inputConfigs * Required. Input configurations. - * The total number of files matched should be <= 1000. + * 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. * @param {google.cloud.translation.v3.OutputConfig} request.outputConfig @@ -969,7 +1134,8 @@ export class TranslationServiceClient { * 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/labels for more information. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1068,6 +1234,210 @@ export class TranslationServiceClient { protos.google.cloud.translation.v3.BatchTranslateMetadata >; } + batchTranslateDocument( + request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchTranslateDocument( + request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateDocument( + request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a regional call. + * + * 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. + * @param {string} request.sourceLanguageCode + * Required. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support (https://cloud.google.com/translate/docs/languages). + * @param {string[]} request.targetLanguageCodes + * Required. The BCP-47 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param {number[]} request.inputConfigs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param {google.cloud.translation.v3.BatchDocumentOutputConfig} request.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. + * @param {number[]} [request.models] + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the 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. + * @param {number[]} [request.glossaries] + * Optional. Glossaries to be applied. It's keyed by target language code. + * @param {number[]} [request.formatConversions] + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.batchTranslateDocument(request); + * const [response] = await operation.promise(); + */ + batchTranslateDocument( + request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.batchTranslateDocument( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchTranslateDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkBatchTranslateDocumentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkBatchTranslateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchTranslateDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata + >; + } createGlossary( request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest, options?: CallOptions @@ -1404,7 +1774,20 @@ export class TranslationServiceClient { * The first page is returned if `page_token`is empty or missing. * @param {string} [request.filter] * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. * If missing, no filtering is performed. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1479,7 +1862,20 @@ export class TranslationServiceClient { * The first page is returned if `page_token`is empty or missing. * @param {string} [request.filter] * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. * If missing, no filtering is performed. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1532,7 +1928,20 @@ export class TranslationServiceClient { * The first page is returned if `page_token`is empty or missing. * @param {string} [request.filter] * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. * If missing, no filtering is performed. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. diff --git a/src/v3/translation_service_client_config.json b/src/v3/translation_service_client_config.json index 1bddde9c..d17bfe2c 100644 --- a/src/v3/translation_service_client_config.json +++ b/src/v3/translation_service_client_config.json @@ -35,11 +35,21 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "TranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "BatchTranslateText": { "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "BatchTranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateGlossary": { "timeout_millis": 600000, "retry_codes_name": "non_idempotent", diff --git a/src/v3beta1/translation_service_client.ts b/src/v3beta1/translation_service_client.ts index 7fa706de..538e3711 100644 --- a/src/v3beta1/translation_service_client.ts +++ b/src/v3beta1/translation_service_client.ts @@ -1340,6 +1340,17 @@ export class TranslationServiceClient { * pair, then default google model (nmt) is used. * @param {number[]} [request.glossaries] * Optional. Glossaries to be applied. It's keyed by target language code. + * @param {number[]} [request.formatConversions] + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/test/gapic_translation_service_v3.ts b/test/gapic_translation_service_v3.ts index 028f6310..5ab25331 100644 --- a/test/gapic_translation_service_v3.ts +++ b/test/gapic_translation_service_v3.ts @@ -564,6 +564,117 @@ describe('v3.TranslationServiceClient', () => { }); }); + describe('translateDocument', () => { + it('invokes translateDocument without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = stubSimpleCall(expectedResponse); + const [response] = await client.translateDocument(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.translateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes translateDocument without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.translateDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.ITranslateDocumentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.translateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes translateDocument with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.translateDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.translateDocument(request), expectedError); + assert( + (client.innerApiCalls.translateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('getGlossary', () => { it('invokes getGlossary without error', async () => { const client = new translationserviceModule.v3.TranslationServiceClient({ @@ -869,6 +980,203 @@ describe('v3.TranslationServiceClient', () => { }); }); + describe('batchTranslateDocument', () => { + it('invokes batchTranslateDocument without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchTranslateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchTranslateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchTranslateDocument without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchTranslateDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchTranslateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchTranslateDocument with call error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchTranslateDocument(request), + expectedError + ); + assert( + (client.innerApiCalls.batchTranslateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchTranslateDocument with LRO error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchTranslateDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchTranslateDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchTranslateDocumentProgress without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchTranslateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchTranslateDocumentProgress with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkBatchTranslateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('createGlossary', () => { it('invokes createGlossary without error', async () => { const client = new translationserviceModule.v3.TranslationServiceClient({