From 7231a558109b1762aa2bc71af0959ba7af262f98 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 6 Apr 2026 20:59:50 +0000 Subject: [PATCH 1/2] feat: A new field `mime_type` is added to message `.google.cloud.translation.v3.AdaptiveMtTranslateRequest` PiperOrigin-RevId: 895422613 Source-Link: https://github.com/googleapis/googleapis/commit/d6837a5d7ade64ff39489285632a44eccf78a2ce Source-Link: https://github.com/googleapis/googleapis-gen/commit/cd509eab2a6ba64365892533b49ef2a939b89ef2 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLXRyYW5zbGF0ZS12My8uT3dsQm90LnlhbWwiLCJoIjoiY2Q1MDllYWIyYTZiYTY0MzY1ODkyNTMzYjQ5ZWYyYTkzOWI4OWVmMiJ9 --- .../google-cloud-translate-v3/.gitignore | 22 + .../.repo-metadata.json | 18 + .../google-cloud-translate-v3/.rubocop.yml | 33 + .../google-cloud-translate-v3/.toys.rb | 28 + .../google-cloud-translate-v3/.yardopts | 12 + .../AUTHENTICATION.md | 122 + .../google-cloud-translate-v3/CHANGELOG.md | 2 + .../google-cloud-translate-v3/Gemfile | 14 + .../google-cloud-translate-v3/LICENSE.md | 201 + .../google-cloud-translate-v3/README.md | 154 + .../google-cloud-translate-v3/Rakefile | 169 + .../gapic_metadata.json | 208 + .../google-cloud-translate-v3.gemspec | 30 + .../lib/google-cloud-translate-v3.rb | 21 + .../lib/google/cloud/translate/v3.rb | 45 + .../cloud/translate/v3/adaptive_mt_pb.rb | 48 + .../translate/v3/automl_translation_pb.rb | 54 + .../cloud/translate/v3/bindings_override.rb | 75 + .../google/cloud/translate/v3/common_pb.rb | 31 + .../lib/google/cloud/translate/v3/rest.rb | 38 + .../cloud/translate/v3/translation_service.rb | 56 + .../v3/translation_service/client.rb | 4616 +++++++++++++++++ .../v3/translation_service/credentials.rb | 52 + .../v3/translation_service/operations.rb | 849 +++ .../translate/v3/translation_service/paths.rb | 168 + .../translate/v3/translation_service/rest.rb | 54 + .../v3/translation_service/rest/client.rb | 4315 +++++++++++++++ .../v3/translation_service/rest/operations.rb | 1093 ++++ .../translation_service/rest/service_stub.rb | 2454 +++++++++ .../translate/v3/translation_service_pb.rb | 88 + .../v3/translation_service_services_pb.rb | 141 + .../lib/google/cloud/translate/v3/version.rb | 28 + .../proto_docs/README.md | 4 + .../proto_docs/google/api/client.rb | 593 +++ .../proto_docs/google/api/field_behavior.rb | 85 + .../proto_docs/google/api/launch_stage.rb | 71 + .../proto_docs/google/api/resource.rb | 227 + .../google/cloud/translate/v3/adaptive_mt.rb | 408 ++ .../cloud/translate/v3/automl_translation.rb | 487 ++ .../google/cloud/translate/v3/common.rb | 143 + .../cloud/translate/v3/translation_service.rb | 1657 ++++++ .../google/longrunning/operations.rb | 191 + .../proto_docs/google/protobuf/any.rb | 145 + .../proto_docs/google/protobuf/duration.rb | 98 + .../proto_docs/google/protobuf/empty.rb | 34 + .../proto_docs/google/protobuf/field_mask.rb | 229 + .../proto_docs/google/protobuf/timestamp.rb | 127 + .../proto_docs/google/rpc/status.rb | 48 + .../snippets/Gemfile | 32 + ..._metadata_google.cloud.translation.v3.json | 1535 ++++++ .../adaptive_mt_translate.rb | 47 + .../batch_translate_document.rb | 54 + .../batch_translate_text.rb | 54 + .../create_adaptive_mt_dataset.rb | 47 + .../translation_service/create_dataset.rb | 54 + .../translation_service/create_glossary.rb | 54 + .../create_glossary_entry.rb | 47 + .../translation_service/create_model.rb | 54 + .../delete_adaptive_mt_dataset.rb | 47 + .../delete_adaptive_mt_file.rb | 47 + .../translation_service/delete_dataset.rb | 54 + .../translation_service/delete_glossary.rb | 54 + .../delete_glossary_entry.rb | 47 + .../translation_service/delete_model.rb | 54 + .../translation_service/detect_language.rb | 47 + .../translation_service/export_data.rb | 54 + .../get_adaptive_mt_dataset.rb | 47 + .../get_adaptive_mt_file.rb | 47 + .../translation_service/get_dataset.rb | 47 + .../translation_service/get_glossary.rb | 47 + .../translation_service/get_glossary_entry.rb | 47 + .../snippets/translation_service/get_model.rb | 47 + .../get_supported_languages.rb | 47 + .../import_adaptive_mt_file.rb | 47 + .../translation_service/import_data.rb | 54 + .../list_adaptive_mt_datasets.rb | 51 + .../list_adaptive_mt_files.rb | 51 + .../list_adaptive_mt_sentences.rb | 51 + .../translation_service/list_datasets.rb | 51 + .../translation_service/list_examples.rb | 51 + .../translation_service/list_glossaries.rb | 51 + .../list_glossary_entries.rb | 51 + .../translation_service/list_models.rb | 51 + .../translation_service/romanize_text.rb | 47 + .../translation_service/translate_document.rb | 47 + .../translation_service/translate_text.rb | 47 + .../translation_service/update_glossary.rb | 54 + .../update_glossary_entry.rb | 47 + .../v3/translation_service_operations_test.rb | 400 ++ .../v3/translation_service_paths_test.rb | 127 + .../v3/translation_service_rest_test.rb | 2229 ++++++++ .../translate/v3/translation_service_test.rb | 2577 +++++++++ .../google-cloud-translate-v3/test/helper.rb | 26 + 93 files changed, 28607 insertions(+) create mode 100644 owl-bot-staging/google-cloud-translate-v3/.gitignore create mode 100644 owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json create mode 100644 owl-bot-staging/google-cloud-translate-v3/.rubocop.yml create mode 100644 owl-bot-staging/google-cloud-translate-v3/.toys.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/.yardopts create mode 100644 owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md create mode 100644 owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md create mode 100644 owl-bot-staging/google-cloud-translate-v3/Gemfile create mode 100644 owl-bot-staging/google-cloud-translate-v3/LICENSE.md create mode 100644 owl-bot-staging/google-cloud-translate-v3/README.md create mode 100644 owl-bot-staging/google-cloud-translate-v3/Rakefile create mode 100644 owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb create mode 100644 owl-bot-staging/google-cloud-translate-v3/test/helper.rb diff --git a/owl-bot-staging/google-cloud-translate-v3/.gitignore b/owl-bot-staging/google-cloud-translate-v3/.gitignore new file mode 100644 index 000000000000..0135b6bc6cfc --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/.gitignore @@ -0,0 +1,22 @@ +# Ignore bundler lockfiles +Gemfile.lock +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json b/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json new file mode 100644 index 000000000000..550038f3aaea --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json @@ -0,0 +1,18 @@ +{ + "api_id": "translate.googleapis.com", + "api_shortname": "translate", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest", + "distribution_name": "google-cloud-translate-v3", + "is_cloud": true, + "language": "ruby", + "name": "translate", + "name_pretty": "Cloud Translation V3 API", + "product_documentation": "https://cloud.google.com/translate", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. Note that google-cloud-translate-v3 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-translate instead. See the readme for more details.", + "ruby-cloud-env-prefix": "TRANSLATE", + "ruby-cloud-product-url": "https://cloud.google.com/translate", + "library_type": "GAPIC_AUTO" +} diff --git a/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml b/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml new file mode 100644 index 000000000000..68b485677107 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-translate-v3.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-cloud-translate-v3.rb" diff --git a/owl-bot-staging/google-cloud-translate-v3/.toys.rb b/owl-bot-staging/google-cloud-translate-v3/.toys.rb new file mode 100644 index 000000000000..177e22456e8a --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/owl-bot-staging/google-cloud-translate-v3/.yardopts b/owl-bot-staging/google-cloud-translate-v3/.yardopts new file mode 100644 index 000000000000..6a5acb03bbde --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Cloud Translation V3 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md b/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md new file mode 100644 index 000000000000..f67deb161865 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-cloud-translate-v3 library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-cloud-translate-v3 library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/cloud/translate/v3" + +client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/cloud/translate/v3" + +::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Cloud::Translate::V3::TranslationService::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-cloud-translate-v3 +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/translate/v3" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Cloud::Translate::V3::TranslationService::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md b/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/owl-bot-staging/google-cloud-translate-v3/Gemfile b/owl-bot-staging/google-cloud-translate-v3/Gemfile new file mode 100644 index 000000000000..1d08558908d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/Gemfile @@ -0,0 +1,14 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.32.0" +gem "irb", "~> 1.17" +gem "minitest", "~> 6.0.2" +gem "minitest-focus", "~> 1.4" +gem "minitest-mock", "~> 5.27" +gem "minitest-rg", "~> 5.3" +gem "ostruct", "~> 0.5.5" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/owl-bot-staging/google-cloud-translate-v3/LICENSE.md b/owl-bot-staging/google-cloud-translate-v3/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + 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. diff --git a/owl-bot-staging/google-cloud-translate-v3/README.md b/owl-bot-staging/google-cloud-translate-v3/README.md new file mode 100644 index 000000000000..99718bb0a50c --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/README.md @@ -0,0 +1,154 @@ +# Ruby Client for the Cloud Translation V3 API + +Integrates text translation into your website or application. + +Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Cloud Translation V3 API. Most users should consider using +the main client gem, +[google-cloud-translate](https://rubygems.org/gems/google-cloud-translate). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-translate-v3 +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/translate.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/translate/v3" + +client = ::Google::Cloud::Translate::V3::TranslationService::Client.new +request = ::Google::Cloud::Translate::V3::TranslateTextRequest.new # (request fields as keyword arguments...) +response = client.translate_text request +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest) +for class and method documentation. + +See also the [Product Documentation](https://cloud.google.com/translate) +for general usage information. + +## Debug Logging + +This library comes with opt-in Debug Logging that can help you troubleshoot +your application's integration with the API. When logging is activated, key +events such as requests and responses, along with data payloads and metadata +such as headers and client configuration, are logged to the standard error +stream. + +**WARNING:** Client Library Debug Logging includes your data payloads in +plaintext, which could include sensitive data such as PII for yourself or your +customers, private keys, or other security data that could be compromising if +leaked. Always practice good data hygiene with your application logs, and follow +the principle of least access. Google also recommends that Client Library Debug +Logging be enabled only temporarily during active debugging, and not used +permanently in production. + +To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` +to the value `all`. Alternatively, you can set the value to a comma-delimited +list of client library gem names. This will select the default logging behavior, +which writes logs to the standard error stream. On a local workstation, this may +result in logs appearing on the console. When running on a Google Cloud hosting +service such as [Google Cloud Run](https://cloud.google.com/run), this generally +results in logs appearing alongside your application logs in the +[Google Cloud Logging](https://cloud.google.com/logging/) service. + +You can customize logging by modifying the `logger` configuration when +constructing a client object. For example: + +```ruby +require "google/cloud/translate/v3" +require "logger" + +client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.logger = Logger.new "my-app.log" +end +``` + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 3.0+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-cloud-translate`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-translate-v3`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-cloud-translate`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-cloud-translate-v3`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/owl-bot-staging/google-cloud-translate-v3/Rakefile b/owl-bot-staging/google-cloud-translate-v3/Rakefile new file mode 100644 index 000000000000..06aca81cc0ab --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-cloud-translate-v3 acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["TRANSLATE_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["TRANSLATE_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["TRANSLATE_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or TRANSLATE_TEST_PROJECT=test123 TRANSLATE_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/cloud/translate/v3/translation_service/credentials" + ::Google::Cloud::Translate::V3::TranslationService::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["TRANSLATE_PROJECT"] = project + ENV["TRANSLATE_TEST_PROJECT"] = project + ENV["TRANSLATE_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-cloud-translate-v3 gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-translate-v3 gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-translate-v3 gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-cloud-translate-v3 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-translate-v3" + header "google-cloud-translate-v3 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-translate-v3 yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-translate-v3 test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-cloud-translate-v3 smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-cloud-translate-v3 acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json b/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json new file mode 100644 index 000000000000..e12339b2e4a4 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json @@ -0,0 +1,208 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.cloud.translation.v3", + "libraryPackage": "::Google::Cloud::Translate::V3", + "services": { + "TranslationService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Translate::V3::TranslationService::Client", + "rpcs": { + "TranslateText": { + "methods": [ + "translate_text" + ] + }, + "RomanizeText": { + "methods": [ + "romanize_text" + ] + }, + "DetectLanguage": { + "methods": [ + "detect_language" + ] + }, + "GetSupportedLanguages": { + "methods": [ + "get_supported_languages" + ] + }, + "TranslateDocument": { + "methods": [ + "translate_document" + ] + }, + "BatchTranslateText": { + "methods": [ + "batch_translate_text" + ] + }, + "BatchTranslateDocument": { + "methods": [ + "batch_translate_document" + ] + }, + "CreateGlossary": { + "methods": [ + "create_glossary" + ] + }, + "UpdateGlossary": { + "methods": [ + "update_glossary" + ] + }, + "ListGlossaries": { + "methods": [ + "list_glossaries" + ] + }, + "GetGlossary": { + "methods": [ + "get_glossary" + ] + }, + "DeleteGlossary": { + "methods": [ + "delete_glossary" + ] + }, + "GetGlossaryEntry": { + "methods": [ + "get_glossary_entry" + ] + }, + "ListGlossaryEntries": { + "methods": [ + "list_glossary_entries" + ] + }, + "CreateGlossaryEntry": { + "methods": [ + "create_glossary_entry" + ] + }, + "UpdateGlossaryEntry": { + "methods": [ + "update_glossary_entry" + ] + }, + "DeleteGlossaryEntry": { + "methods": [ + "delete_glossary_entry" + ] + }, + "CreateDataset": { + "methods": [ + "create_dataset" + ] + }, + "GetDataset": { + "methods": [ + "get_dataset" + ] + }, + "ListDatasets": { + "methods": [ + "list_datasets" + ] + }, + "DeleteDataset": { + "methods": [ + "delete_dataset" + ] + }, + "CreateAdaptiveMtDataset": { + "methods": [ + "create_adaptive_mt_dataset" + ] + }, + "DeleteAdaptiveMtDataset": { + "methods": [ + "delete_adaptive_mt_dataset" + ] + }, + "GetAdaptiveMtDataset": { + "methods": [ + "get_adaptive_mt_dataset" + ] + }, + "ListAdaptiveMtDatasets": { + "methods": [ + "list_adaptive_mt_datasets" + ] + }, + "AdaptiveMtTranslate": { + "methods": [ + "adaptive_mt_translate" + ] + }, + "GetAdaptiveMtFile": { + "methods": [ + "get_adaptive_mt_file" + ] + }, + "DeleteAdaptiveMtFile": { + "methods": [ + "delete_adaptive_mt_file" + ] + }, + "ImportAdaptiveMtFile": { + "methods": [ + "import_adaptive_mt_file" + ] + }, + "ListAdaptiveMtFiles": { + "methods": [ + "list_adaptive_mt_files" + ] + }, + "ListAdaptiveMtSentences": { + "methods": [ + "list_adaptive_mt_sentences" + ] + }, + "ImportData": { + "methods": [ + "import_data" + ] + }, + "ExportData": { + "methods": [ + "export_data" + ] + }, + "ListExamples": { + "methods": [ + "list_examples" + ] + }, + "CreateModel": { + "methods": [ + "create_model" + ] + }, + "ListModels": { + "methods": [ + "list_models" + ] + }, + "GetModel": { + "methods": [ + "get_model" + ] + }, + "DeleteModel": { + "methods": [ + "delete_model" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec b/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec new file mode 100644 index 000000000000..b3eb7135a809 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec @@ -0,0 +1,30 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/translate/v3/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-translate-v3" + gem.version = Google::Cloud::Translate::V3::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. Note that google-cloud-translate-v3 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-translate instead. See the readme for more details." + gem.summary = "Integrates text translation into your website or application." + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 3.2" + + gem.add_dependency "gapic-common", "~> 1.2" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "google-cloud-location", "~> 1.0" + gem.add_dependency "google-iam-v1", "~> 1.3" +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb new file mode 100644 index 000000000000..4feb19bf3cb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/cloud/translate/v3" diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb new file mode 100644 index 000000000000..9da4decef7f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/translate/v3/translation_service" +require "google/cloud/translate/v3/version" + +module Google + module Cloud + module Translate + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/translate/v3" + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/translate/v3" + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + module V3 + end + end + end +end + +helper_path = ::File.join __dir__, "v3", "_helpers.rb" +require "google/cloud/translate/v3/_helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb new file mode 100644 index 000000000000..a65944af7001 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/translate/v3/adaptive_mt.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/translate/v3/common_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n+google/cloud/translate/v3/adaptive_mt.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa1\x03\n\x11\x41\x64\x61ptiveMtDataset\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x15\n\rexample_count\x18\x05 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:u\xea\x41r\n*translate.googleapis.com/AdaptiveMtDataset\x12\x44projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}\"\xad\x01\n\x1e\x43reateAdaptiveMtDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12P\n\x13\x61\x64\x61ptive_mt_dataset\x18\x02 \x01(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x02\"b\n\x1e\x44\x65leteAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"_\n\x1bGetAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"\xa0\x01\n\x1dListAdaptiveMtDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"\x91\x01\n\x1eListAdaptiveMtDatasetsResponse\x12Q\n\x14\x61\x64\x61ptive_mt_datasets\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\x9e\x08\n\x1a\x41\x64\x61ptiveMtTranslateRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x43\n\x07\x64\x61taset\x18\x02 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x07\x63ontent\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12\x11\n\tmime_type\x18\x04 \x01(\t\x12w\n\x19reference_sentence_config\x18\x06 \x01(\x0b\x32O.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfigH\x00\x88\x01\x01\x12i\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x46.google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfigB\x03\xe0\x41\x01H\x01\x88\x01\x01\x1aI\n\x15ReferenceSentencePair\x12\x17\n\x0fsource_sentence\x18\x01 \x01(\t\x12\x17\n\x0ftarget_sentence\x18\x02 \x01(\t\x1a\x8c\x01\n\x19ReferenceSentencePairList\x12o\n\x18reference_sentence_pairs\x18\x01 \x03(\x0b\x32M.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair\x1a\xcf\x01\n\x17ReferenceSentenceConfig\x12x\n\x1dreference_sentence_pair_lists\x18\x01 \x03(\x0b\x32Q.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList\x12\x1c\n\x14source_language_code\x18\x02 \x01(\t\x12\x1c\n\x14target_language_code\x18\x03 \x01(\t\x1a\x94\x01\n\x0eGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x42\x1c\n\x1a_reference_sentence_configB\x12\n\x10_glossary_config\"5\n\x15\x41\x64\x61ptiveMtTranslation\x12\x1c\n\x0ftranslated_text\x18\x01 \x01(\tB\x03\xe0\x41\x03\"\xdb\x01\n\x1b\x41\x64\x61ptiveMtTranslateResponse\x12M\n\x0ctranslations\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslationB\x03\xe0\x41\x03\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12Q\n\x15glossary_translations\x18\x04 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslation\"\x94\x03\n\x0e\x41\x64\x61ptiveMtFile\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xab\x01\xea\x41\xa7\x01\n\'translate.googleapis.com/AdaptiveMtFile\x12[projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}*\x0f\x61\x64\x61ptiveMtFiles2\x0e\x61\x64\x61ptiveMtFile\"Y\n\x18GetAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\\\n\x1b\x44\x65leteAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\xff\x01\n\x1bImportAdaptiveMtFileRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12I\n\x11\x66ile_input_source\x18\x02 \x01(\x0b\x32,.google.cloud.translation.v3.FileInputSourceH\x00\x12G\n\x10gcs_input_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"j\n\x1cImportAdaptiveMtFileResponse\x12J\n\x10\x61\x64\x61ptive_mt_file\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\"\x91\x01\n\x1aListAdaptiveMtFilesRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x88\x01\n\x1bListAdaptiveMtFilesResponse\x12K\n\x11\x61\x64\x61ptive_mt_files\x18\x01 \x03(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\xd8\x03\n\x12\x41\x64\x61ptiveMtSentence\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+translate.googleapis.com/AdaptiveMtSentence\x12\x1c\n\x0fsource_sentence\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftarget_sentence\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xd6\x01\xea\x41\xd2\x01\n+translate.googleapis.com/AdaptiveMtSentence\x12zprojects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}*\x13\x61\x64\x61ptiveMtSentences2\x12\x61\x64\x61ptiveMtSentence\"\x88\x01\n\x1eListAdaptiveMtSentencesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x94\x01\n\x1fListAdaptiveMtSentencesResponse\x12S\n\x15\x61\x64\x61ptive_mt_sentences\x18\x01 \x03(\x0b\x32/.google.cloud.translation.v3.AdaptiveMtSentenceB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\x42\xc6\x01\n\x1d\x63om.google.cloud.translate.v3B\x0f\x41\x64\x61ptiveMtProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Translate + module V3 + AdaptiveMtDataset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtDataset").msgclass + CreateAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest").msgclass + DeleteAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest").msgclass + GetAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetAdaptiveMtDatasetRequest").msgclass + ListAdaptiveMtDatasetsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest").msgclass + ListAdaptiveMtDatasetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse").msgclass + AdaptiveMtTranslateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest").msgclass + AdaptiveMtTranslateRequest::ReferenceSentencePair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair").msgclass + AdaptiveMtTranslateRequest::ReferenceSentencePairList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList").msgclass + AdaptiveMtTranslateRequest::ReferenceSentenceConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfig").msgclass + AdaptiveMtTranslateRequest::GlossaryConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfig").msgclass + AdaptiveMtTranslation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslation").msgclass + AdaptiveMtTranslateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateResponse").msgclass + AdaptiveMtFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtFile").msgclass + GetAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetAdaptiveMtFileRequest").msgclass + DeleteAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteAdaptiveMtFileRequest").msgclass + ImportAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportAdaptiveMtFileRequest").msgclass + ImportAdaptiveMtFileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportAdaptiveMtFileResponse").msgclass + ListAdaptiveMtFilesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtFilesRequest").msgclass + ListAdaptiveMtFilesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtFilesResponse").msgclass + AdaptiveMtSentence = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtSentence").msgclass + ListAdaptiveMtSentencesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtSentencesRequest").msgclass + ListAdaptiveMtSentencesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtSentencesResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb new file mode 100644 index 000000000000..a9711e27fbe7 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/translate/v3/automl_translation.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/translate/v3/common_pb' +require 'google/protobuf/timestamp_pb' +require 'google/rpc/status_pb' + + +descriptor_data = "\n2google/cloud/translate/v3/automl_translation.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\"u\n\x11ImportDataRequest\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12J\n\x0cinput_config\x18\x02 \x01(\x0b\x32/.google.cloud.translation.v3.DatasetInputConfigB\x03\xe0\x41\x02\"\xd2\x01\n\x12\x44\x61tasetInputConfig\x12N\n\x0binput_files\x18\x01 \x03(\x0b\x32\x39.google.cloud.translation.v3.DatasetInputConfig.InputFile\x1al\n\tInputFile\x12\x12\n\x05usage\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x41\n\ngcs_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"\xd5\x01\n\x12ImportDataMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"w\n\x11\x45xportDataRequest\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12L\n\routput_config\x18\x02 \x01(\x0b\x32\x30.google.cloud.translation.v3.DatasetOutputConfigB\x03\xe0\x41\x02\"r\n\x13\x44\x61tasetOutputConfig\x12L\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x31.google.cloud.translation.v3.GcsOutputDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\xd5\x01\n\x12\x45xportDataMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"N\n\x14\x44\x65leteDatasetRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\"\xd8\x01\n\x15\x44\x65leteDatasetMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"K\n\x11GetDatasetRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\"\x81\x01\n\x13ListDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"g\n\x14ListDatasetsResponse\x12\x36\n\x08\x64\x61tasets\x18\x01 \x03(\x0b\x32$.google.cloud.translation.v3.Dataset\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x8d\x01\n\x14\x43reateDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12:\n\x07\x64\x61taset\x18\x02 \x01(\x0b\x32$.google.cloud.translation.v3.DatasetB\x03\xe0\x41\x02\"\xd8\x01\n\x15\x43reateDatasetMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\x95\x01\n\x13ListExamplesRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\"g\n\x14ListExamplesResponse\x12\x36\n\x08\x65xamples\x18\x01 \x03(\x0b\x32$.google.cloud.translation.v3.Example\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xd0\x01\n\x07\x45xample\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x13\n\x0bsource_text\x18\x02 \x01(\t\x12\x13\n\x0btarget_text\x18\x03 \x01(\t\x12\x12\n\x05usage\x18\x04 \x01(\tB\x03\xe0\x41\x03:t\xea\x41q\n translate.googleapis.com/Example\x12Mprojects/{project}/locations/{location}/datasets/{dataset}/examples/{example}\"\xe8\x01\n\x1e\x42\x61tchTransferResourcesResponse\x12g\n\tresponses\x18\x01 \x03(\x0b\x32T.google.cloud.translation.v3.BatchTransferResourcesResponse.TransferResourceResponse\x1a]\n\x18TransferResourceResponse\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0e\n\x06target\x18\x02 \x01(\t\x12!\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x12.google.rpc.Status\"\xbc\x03\n\x07\x44\x61taset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x1a\n\rexample_count\x18\x05 \x01(\x05\x42\x03\xe0\x41\x03\x12 \n\x13train_example_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12#\n\x16validate_example_count\x18\x07 \x01(\x05\x42\x03\xe0\x41\x03\x12\x1f\n\x12test_example_count\x18\x08 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:a\xea\x41^\n translate.googleapis.com/Dataset\x12:projects/{project}/locations/{location}/datasets/{dataset}\"\x87\x01\n\x12\x43reateModelRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x36\n\x05model\x18\x02 \x01(\x0b\x32\".google.cloud.translation.v3.ModelB\x03\xe0\x41\x02\"\xd6\x01\n\x13\x43reateModelMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\x94\x01\n\x11ListModelsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"a\n\x12ListModelsResponse\x12\x32\n\x06models\x18\x01 \x03(\x0b\x32\".google.cloud.translation.v3.Model\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"G\n\x0fGetModelRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1etranslate.googleapis.com/Model\"J\n\x12\x44\x65leteModelRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1etranslate.googleapis.com/Model\"\xd6\x01\n\x13\x44\x65leteModelMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\xb3\x03\n\x05Model\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x61taset\x18\x03 \x01(\t\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x03\x12 \n\x13train_example_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12#\n\x16validate_example_count\x18\x07 \x01(\x05\x42\x03\xe0\x41\x03\x12\x1f\n\x12test_example_count\x18\x0c \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:[\xea\x41X\n\x1etranslate.googleapis.com/Model\x12\x36projects/{project}/locations/{location}/models/{model}B\xcd\x01\n\x1d\x63om.google.cloud.translate.v3B\x16\x41utoMLTranslationProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Translate + module V3 + ImportDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportDataRequest").msgclass + DatasetInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetInputConfig").msgclass + DatasetInputConfig::InputFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetInputConfig.InputFile").msgclass + ImportDataMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportDataMetadata").msgclass + ExportDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ExportDataRequest").msgclass + DatasetOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetOutputConfig").msgclass + ExportDataMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ExportDataMetadata").msgclass + DeleteDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteDatasetRequest").msgclass + DeleteDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteDatasetMetadata").msgclass + GetDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetDatasetRequest").msgclass + ListDatasetsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListDatasetsRequest").msgclass + ListDatasetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListDatasetsResponse").msgclass + CreateDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateDatasetRequest").msgclass + CreateDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateDatasetMetadata").msgclass + ListExamplesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListExamplesRequest").msgclass + ListExamplesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListExamplesResponse").msgclass + Example = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Example").msgclass + BatchTransferResourcesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTransferResourcesResponse").msgclass + BatchTransferResourcesResponse::TransferResourceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTransferResourcesResponse.TransferResourceResponse").msgclass + Dataset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Dataset").msgclass + CreateModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateModelRequest").msgclass + CreateModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateModelMetadata").msgclass + ListModelsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListModelsRequest").msgclass + ListModelsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListModelsResponse").msgclass + GetModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetModelRequest").msgclass + DeleteModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteModelRequest").msgclass + DeleteModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteModelMetadata").msgclass + Model = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Model").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb new file mode 100644 index 000000000000..780f191863aa --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" + +module Google + module Cloud + module Translate + ## + # @example Loading just the REST part of this package, including all its services, and instantiating a REST client + # + # require "google/cloud/translate/v3/rest" + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + module V3 + ## + # @private + # Initialize the mixin bindings configuration + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Translate"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + + default_config = ::Gapic::Rest::HttpBindingOverrideConfiguration.new parent_config + default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [ + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ], + body: nil + ) + ] + default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [ + + Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( + uri_method: :get, + uri_template: "/v3/{name}/locations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ], + body: nil + ) + ] + default_config + end + yield @configure if block_given? + @configure + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb new file mode 100644 index 000000000000..a0a6b10db393 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/translate/v3/common.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' + + +descriptor_data = "\n&google/cloud/translate/v3/common.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\"(\n\x0eGcsInputSource\x12\x16\n\tinput_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\"Z\n\x0f\x46ileInputSource\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07\x63ontent\x18\x02 \x01(\x0c\x42\x03\xe0\x41\x02\x12\x19\n\x0c\x64isplay_name\x18\x03 \x01(\tB\x03\xe0\x41\x02\"6\n\x14GcsOutputDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\"\xf8\x04\n\rGlossaryEntry\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12R\n\nterms_pair\x18\x02 \x01(\x0b\x32<.google.cloud.translation.v3.GlossaryEntry.GlossaryTermsPairH\x00\x12P\n\tterms_set\x18\x03 \x01(\x0b\x32;.google.cloud.translation.v3.GlossaryEntry.GlossaryTermsSetH\x00\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t\x1a\x93\x01\n\x11GlossaryTermsPair\x12>\n\x0bsource_term\x18\x01 \x01(\x0b\x32).google.cloud.translation.v3.GlossaryTerm\x12>\n\x0btarget_term\x18\x02 \x01(\x0b\x32).google.cloud.translation.v3.GlossaryTerm\x1aL\n\x10GlossaryTermsSet\x12\x38\n\x05terms\x18\x01 \x03(\x0b\x32).google.cloud.translation.v3.GlossaryTerm:\xac\x01\xea\x41\xa8\x01\n&translate.googleapis.com/GlossaryEntry\x12^projects/{project}/locations/{location}/glossaries/{glossary}/glossaryEntries/{glossary_entry}*\x0fglossaryEntries2\rglossaryEntryB\x06\n\x04\x64\x61ta\"3\n\x0cGlossaryTerm\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x0c\n\x04text\x18\x02 \x01(\t*\xc8\x01\n\x0eOperationState\x12\x1f\n\x1bOPERATION_STATE_UNSPECIFIED\x10\x00\x12\x1b\n\x17OPERATION_STATE_RUNNING\x10\x01\x12\x1d\n\x19OPERATION_STATE_SUCCEEDED\x10\x02\x12\x1a\n\x16OPERATION_STATE_FAILED\x10\x03\x12\x1e\n\x1aOPERATION_STATE_CANCELLING\x10\x04\x12\x1d\n\x19OPERATION_STATE_CANCELLED\x10\x05\x42\xc2\x01\n\x1d\x63om.google.cloud.translate.v3B\x0b\x43ommonProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Translate + module V3 + GcsInputSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsInputSource").msgclass + FileInputSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.FileInputSource").msgclass + GcsOutputDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsOutputDestination").msgclass + GlossaryEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry").msgclass + GlossaryEntry::GlossaryTermsPair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry.GlossaryTermsPair").msgclass + GlossaryEntry::GlossaryTermsSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry.GlossaryTermsSet").msgclass + GlossaryTerm = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryTerm").msgclass + OperationState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.OperationState").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb new file mode 100644 index 000000000000..a65a2908a2bd --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/translate/v3/translation_service/rest" +require "google/cloud/translate/v3/bindings_override" +require "google/cloud/translate/v3/version" + +module Google + module Cloud + module Translate + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/translate/v3/rest" + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + module V3 + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb new file mode 100644 index 000000000000..95ca52623d45 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/translate/v3/version" + +require "google/cloud/translate/v3/translation_service/credentials" +require "google/cloud/translate/v3/translation_service/paths" +require "google/cloud/translate/v3/translation_service/operations" +require "google/cloud/translate/v3/translation_service/client" +require "google/cloud/translate/v3/translation_service/rest" + +module Google + module Cloud + module Translate + module V3 + ## + # Provides natural language translation operations. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/translate/v3/translation_service" + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/translate/v3/translation_service/rest" + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + module TranslationService + end + end + end + end +end + +helper_path = ::File.join __dir__, "translation_service", "helpers.rb" +require "google/cloud/translate/v3/translation_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb new file mode 100644 index 000000000000..f55ab86a53b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb @@ -0,0 +1,4616 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/translate/v3/translation_service_pb" +require "google/cloud/location" +require "google/iam/v1" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + ## + # Client for the TranslationService service. + # + # Provides natural language translation operations. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :translation_service_stub + + ## + # Configure the TranslationService Client class. + # + # See {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all TranslationService clients + # ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Translate", "V3"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.translate_text.timeout = 600.0 + + default_config.rpcs.detect_language.timeout = 600.0 + + default_config.rpcs.get_supported_languages.timeout = 600.0 + default_config.rpcs.get_supported_languages.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.translate_document.timeout = 600.0 + + default_config.rpcs.batch_translate_text.timeout = 600.0 + + default_config.rpcs.batch_translate_document.timeout = 600.0 + + default_config.rpcs.create_glossary.timeout = 600.0 + + default_config.rpcs.list_glossaries.timeout = 600.0 + default_config.rpcs.list_glossaries.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.get_glossary.timeout = 600.0 + default_config.rpcs.get_glossary.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.delete_glossary.timeout = 600.0 + default_config.rpcs.delete_glossary.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the TranslationService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @translation_service_stub.universe_domain + end + + ## + # Create a new TranslationService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the TranslationService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/translate/v3/translation_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @translation_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Translate::V3::TranslationService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @translation_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @translation_service_stub.endpoint + config.universe_domain = @translation_service_stub.universe_domain + config.logger = @translation_service_stub.logger if config.respond_to? :logger= + end + + @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @translation_service_stub.endpoint + config.universe_domain = @translation_service_stub.universe_domain + config.logger = @translation_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Translate::V3::TranslationService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # Get the associated client for mix-in of the IAMPolicy. + # + # @return [Google::Iam::V1::IAMPolicy::Client] + # + attr_reader :iam_policy_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @translation_service_stub.logger + end + + # Service calls + + ## + # Translates input text and returns translated text. + # + # @overload translate_text(request, options = nil) + # Pass arguments to `translate_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::TranslateTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::TranslateTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) + # Pass arguments to `translate_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param contents [::Array<::String>] + # Required. The content of the input in string format. + # We recommend the total content be less than 30,000 codepoints. The max + # length of this field is 1024. Use BatchTranslateText for larger text. + # @param mime_type [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @param source_language_code [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "en-US" or "sr-Latn". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). If the source + # language isn't specified, the API attempts to identify the source language + # automatically and returns the source language within the response. + # @param target_language_code [::String] + # Required. The ISO-639 language code to use for translation of the input + # text, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 same + # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + # @param model [::String] + # 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`, + # + # - Translation LLM models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, + # + # For global (non-regionalized) requests, use `location-id` `global`. + # For example, + # `projects/{project-number-or-id}/locations/global/models/general/nmt`. + # + # If not provided, the default Google model (NMT) will be used + # @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] + # 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 transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash] + # Optional. Transliteration to be applied. + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::TranslateTextResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::TranslateTextRequest.new + # + # # Call the translate_text method. + # result = client.translate_text request + # + # # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. + # p result + # + def translate_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.translate_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.translate_text.timeout, + metadata: metadata, + retry_policy: @config.rpcs.translate_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :translate_text, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Romanize input text written in non-Latin scripts to Latin text. + # + # @overload romanize_text(request, options = nil) + # Pass arguments to `romanize_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload romanize_text(parent: nil, contents: nil, source_language_code: nil) + # Pass arguments to `romanize_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # @param contents [::Array<::String>] + # Required. The content of the input in string format. + # @param source_language_code [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "hi" or "zh". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages#roman). If the + # source language isn't specified, the API attempts to identify the source + # language automatically and returns the source language for each content in + # the response. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::RomanizeTextRequest.new + # + # # Call the romanize_text method. + # result = client.romanize_text request + # + # # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. + # p result + # + def romanize_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.romanize_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.romanize_text.timeout, + metadata: metadata, + retry_policy: @config.rpcs.romanize_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :romanize_text, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Detects the language of text within a request. + # + # @overload detect_language(request, options = nil) + # Pass arguments to `detect_language` via a request object, either of type + # {::Google::Cloud::Translate::V3::DetectLanguageRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) + # Pass arguments to `detect_language` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # + # Only models within the same region (has same location-id) can be used. + # Otherwise an INVALID_ARGUMENT (400) error is returned. + # @param model [::String] + # Optional. The language detection model to be used. + # + # Format: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + # + # Only one language detection model is currently supported: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + # + # If not specified, the default model is used. + # @param content [::String] + # The content of the input stored as a string. + # @param mime_type [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DetectLanguageRequest.new + # + # # Call the detect_language method. + # result = client.detect_language request + # + # # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. + # p result + # + def detect_language request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DetectLanguageRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.detect_language.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.detect_language.timeout, + metadata: metadata, + retry_policy: @config.rpcs.detect_language.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :detect_language, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns a list of supported languages for translation. + # + # @overload get_supported_languages(request, options = nil) + # Pass arguments to `get_supported_languages` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_supported_languages(parent: nil, display_language_code: nil, model: nil) + # Pass arguments to `get_supported_languages` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 AutoML models. + # + # Only models within the same region (have same location-id) can be used, + # otherwise an INVALID_ARGUMENT (400) error is returned. + # @param display_language_code [::String] + # Optional. The language to use to return localized, human readable names + # of supported languages. If missing, then display names are not returned + # in a response. + # @param model [::String] + # Optional. Get supported languages of this model. + # + # 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`, + # + # + # Returns languages supported by the specified model. + # If missing, we get supported languages of Google general NMT model. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::SupportedLanguages] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::SupportedLanguages] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new + # + # # Call the get_supported_languages method. + # result = client.get_supported_languages request + # + # # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. + # p result + # + def get_supported_languages request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_supported_languages.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_supported_languages.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_supported_languages.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_supported_languages, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Translates documents in synchronous mode. + # + # @overload translate_document(request, options = nil) + # Pass arguments to `translate_document` via a request object, either of type + # {::Google::Cloud::Translate::V3::TranslateDocumentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) + # Pass arguments to `translate_document` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # 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 source_language_code [::String] + # Optional. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). 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 target_language_code [::String] + # Required. The ISO-639 language code to use for translation of the input + # document, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash] + # Required. Input configurations. + # @param document_output_config [::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash] + # 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 model [::String] + # 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 glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] + # 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 labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters (Unicode + # codepoints), can only contain lowercase letters, numeric characters, + # underscores and dashes. International characters are allowed. Label values + # are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @param customized_attribution [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @param is_translate_native_pdf_only [::Boolean] + # Optional. is_translate_native_pdf_only field for external customers. + # If true, the page limit of online native pdf translation is 300 and only + # native pdf pages will be translated. + # @param enable_shadow_removal_native_pdf [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @param enable_rotation_correction [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new + # + # # Call the translate_document method. + # result = client.translate_document request + # + # # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. + # p result + # + def translate_document request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateDocumentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.translate_document.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.translate_document.timeout, + metadata: metadata, + retry_policy: @config.rpcs.translate_document.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :translate_document, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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 + # 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. + # + # @overload batch_translate_text(request, options = nil) + # Pass arguments to `batch_translate_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::BatchTranslateTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) + # Pass arguments to `batch_translate_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Location to make a call. Must refer to a caller's project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # + # The `global` location is not supported for batch translation. + # + # Only AutoML Translation models or glossaries within the same region (have + # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + # error is returned. + # @param source_language_code [::String] + # Required. Source language code. Supported language codes are listed in + # [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param target_language_codes [::Array<::String>] + # Required. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param models [::Hash{::String => ::String}] + # Optional. The models to use for translation. Map's key is target language + # code. Map's value is model name. Value can be a built-in general model, + # or an AutoML Translation model. + # + # The value format depends on model type: + # + # - AutoML Translation models: + # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + # + # - General (built-in) models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + # + # + # If the map is empty or a specific model is + # not requested for a language pair, then default google model (nmt) is used. + # @param input_configs [::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>] + # Required. Input configurations. + # The total number of files matched should be <= 100. + # The total content size should be <= 100M Unicode codepoints. + # The files must use UTF-8 encoding. + # @param output_config [::Google::Cloud::Translate::V3::OutputConfig, ::Hash] + # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] + # Optional. Glossaries to be applied for translation. + # It's keyed by target language code. + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new + # + # # Call the batch_translate_text method. + # result = client.batch_translate_text request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def batch_translate_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.batch_translate_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.batch_translate_text.timeout, + metadata: metadata, + retry_policy: @config.rpcs.batch_translate_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :batch_translate_text, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload batch_translate_document(request, options = nil) + # Pass arguments to `batch_translate_document` via a request object, either of type + # {::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) + # Pass arguments to `batch_translate_document` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # 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 source_language_code [::String] + # Required. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). + # @param target_language_codes [::Array<::String>] + # Required. The ISO-639 language code to use for translation of the input + # document. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>] + # 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 output_config [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig, ::Hash] + # 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 models [::Hash{::String => ::String}] + # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] + # Optional. Glossaries to be applied. It's keyed by target language code. + # @param format_conversions [::Hash{::String => ::String}] + # Optional. The file format conversion map that is applied to all input + # files. The map key is the original mime_type. The map 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 customized_attribution [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @param enable_shadow_removal_native_pdf [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @param enable_rotation_correction [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new + # + # # Call the batch_translate_document method. + # result = client.batch_translate_document request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def batch_translate_document request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.batch_translate_document.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.batch_translate_document.timeout, + metadata: metadata, + retry_policy: @config.rpcs.batch_translate_document.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :batch_translate_document, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a glossary and returns the long-running operation. Returns + # NOT_FOUND, if the project doesn't exist. + # + # @overload create_glossary(request, options = nil) + # Pass arguments to `create_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_glossary(parent: nil, glossary: nil) + # Pass arguments to `create_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name. + # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] + # Required. The glossary to create. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new + # + # # Call the create_glossary method. + # result = client.create_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_glossary.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :create_glossary, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a glossary. A LRO is used since the update can be async if the + # glossary's entry file is updated. + # + # @overload update_glossary(request, options = nil) + # Pass arguments to `update_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_glossary(glossary: nil, update_mask: nil) + # Pass arguments to `update_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] + # Required. The glossary entry to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The list of fields to be updated. Currently only `display_name` and + # 'input_config' + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new + # + # # Call the update_glossary method. + # result = client.update_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.glossary&.name + header_params["glossary.name"] = request.glossary.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_glossary.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :update_glossary, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + # exist. + # + # @overload list_glossaries(request, options = nil) + # Pass arguments to `list_glossaries` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListGlossariesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_glossaries` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The name of the project from which to list all of the glossaries. + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer glossaries than + # requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of [ListGlossariesResponse.next_page_token] + # returned from the previous call to `ListGlossaries` method. + # The first page is returned if `page_token`is empty or missing. + # @param filter [::String] + # Optional. Filter specifying constraints of a list operation. + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListGlossariesRequest.new + # + # # Call the list_glossaries method. + # result = client.list_glossaries request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Glossary. + # p item + # end + # + def list_glossaries request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossariesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_glossaries.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_glossaries.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_glossaries.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_glossaries, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossaries, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + # exist. + # + # @overload get_glossary(request, options = nil) + # Pass arguments to `get_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_glossary(name: nil) + # Pass arguments to `get_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the glossary to retrieve. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::Glossary] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::Glossary] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetGlossaryRequest.new + # + # # Call the get_glossary method. + # result = client.get_glossary request + # + # # The returned object is of type Google::Cloud::Translate::V3::Glossary. + # p result + # + def get_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_glossary.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_glossary, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a glossary, or cancels glossary construction + # if the glossary isn't created yet. + # Returns NOT_FOUND, if the glossary doesn't exist. + # + # @overload delete_glossary(request, options = nil) + # Pass arguments to `delete_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_glossary(name: nil) + # Pass arguments to `delete_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the glossary to delete. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new + # + # # Call the delete_glossary method. + # result = client.delete_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_glossary.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_glossary, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a single glossary entry by the given id. + # + # @overload get_glossary_entry(request, options = nil) + # Pass arguments to `get_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_glossary_entry(name: nil) + # Pass arguments to `get_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the glossary entry to get + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new + # + # # Call the get_glossary_entry method. + # result = client.get_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def get_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_glossary_entry, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # List the entries for the glossary. + # + # @overload list_glossary_entries(request, options = nil) + # Pass arguments to `list_glossary_entries` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_glossary_entries` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent glossary resource name for listing the glossary's + # entries. + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer glossary entries + # than requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # [ListGlossaryEntriesResponse.next_page_token] returned from the previous + # call. The first page is returned if `page_token`is empty or missing. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new + # + # # Call the list_glossary_entries method. + # result = client.list_glossary_entries request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. + # p item + # end + # + def list_glossary_entries request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_glossary_entries.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_glossary_entries.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_glossary_entries, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a glossary entry. + # + # @overload create_glossary_entry(request, options = nil) + # Pass arguments to `create_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_glossary_entry(parent: nil, glossary_entry: nil) + # Pass arguments to `create_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the glossary to create the entry under. + # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] + # Required. The glossary entry to create + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new + # + # # Call the create_glossary_entry method. + # result = client.create_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def create_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :create_glossary_entry, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a glossary entry. + # + # @overload update_glossary_entry(request, options = nil) + # Pass arguments to `update_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_glossary_entry(glossary_entry: nil) + # Pass arguments to `update_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] + # Required. The glossary entry to update. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new + # + # # Call the update_glossary_entry method. + # result = client.update_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def update_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.glossary_entry&.name + header_params["glossary_entry.name"] = request.glossary_entry.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :update_glossary_entry, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a single entry from the glossary + # + # @overload delete_glossary_entry(request, options = nil) + # Pass arguments to `delete_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_glossary_entry(name: nil) + # Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the glossary entry to delete + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new + # + # # Call the delete_glossary_entry method. + # result = client.delete_glossary_entry request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_glossary_entry, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Dataset. + # + # @overload create_dataset(request, options = nil) + # Pass arguments to `create_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_dataset(parent: nil, dataset: nil) + # Pass arguments to `create_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name. + # @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash] + # Required. The Dataset to create. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateDatasetRequest.new + # + # # Call the create_dataset method. + # result = client.create_dataset request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :create_dataset, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Dataset. + # + # @overload get_dataset(request, options = nil) + # Pass arguments to `get_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_dataset(name: nil) + # Pass arguments to `get_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the dataset to retrieve. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::Dataset] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::Dataset] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetDatasetRequest.new + # + # # Call the get_dataset method. + # result = client.get_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::Dataset. + # p result + # + def get_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_dataset, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists datasets. + # + # @overload list_datasets(request, options = nil) + # Pass arguments to `list_datasets` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_datasets(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_datasets` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListDatasets call. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListDatasetsRequest.new + # + # # Call the list_datasets method. + # result = client.list_datasets request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Dataset. + # p item + # end + # + def list_datasets request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_datasets.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_datasets.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_datasets.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_datasets, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_datasets, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a dataset and all of its contents. + # + # @overload delete_dataset(request, options = nil) + # Pass arguments to `delete_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_dataset(name: nil) + # Pass arguments to `delete_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the dataset to delete. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new + # + # # Call the delete_dataset method. + # result = client.delete_dataset request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_dataset, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates an Adaptive MT dataset. + # + # @overload create_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) + # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash] + # Required. The AdaptiveMtDataset to be created. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new + # + # # Call the create_adaptive_mt_dataset method. + # result = client.create_adaptive_mt_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p result + # + def create_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an Adaptive MT dataset, including all its entries and associated + # metadata. + # + # @overload delete_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_adaptive_mt_dataset(name: nil) + # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new + # + # # Call the delete_adaptive_mt_dataset method. + # result = client.delete_adaptive_mt_dataset request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the Adaptive MT dataset. + # + # @overload get_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_adaptive_mt_dataset(name: nil) + # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new + # + # # Call the get_adaptive_mt_dataset method. + # result = client.get_adaptive_mt_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p result + # + def get_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all Adaptive MT datasets for which the caller has read permission. + # + # @overload list_adaptive_mt_datasets(request, options = nil) + # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer results than + # requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtDatasetsResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtDatasets` method. The first page is + # returned if `page_token`is empty or missing. + # @param filter [::String] + # Optional. An expression for filtering the results of the request. + # Filter is not supported yet. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new + # + # # Call the list_adaptive_mt_datasets method. + # result = client.list_adaptive_mt_datasets request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p item + # end + # + def list_adaptive_mt_datasets request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Translate text using Adaptive MT. + # + # @overload adaptive_mt_translate(request, options = nil) + # Pass arguments to `adaptive_mt_translate` via a request object, either of type + # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) + # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Location to make a regional call. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # @param dataset [::String] + # Required. The resource name for the dataset to use for adaptive MT. + # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + # @param content [::Array<::String>] + # Required. The content of the input in string format. + # @param mime_type [::String] + # The format of the source text. + # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] + # Configuration for caller provided reference sentences. + # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] + # 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. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new + # + # # Call the adaptive_mt_translate method. + # result = client.adaptive_mt_translate request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. + # p result + # + def adaptive_mt_translate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout, + metadata: metadata, + retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets and AdaptiveMtFile + # + # @overload get_adaptive_mt_file(request, options = nil) + # Pass arguments to `get_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_adaptive_mt_file(name: nil) + # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new + # + # # Call the get_adaptive_mt_file method. + # result = client.get_adaptive_mt_file request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. + # p result + # + def get_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an AdaptiveMtFile along with its sentences. + # + # @overload delete_adaptive_mt_file(request, options = nil) + # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_adaptive_mt_file(name: nil) + # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the file to delete, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new + # + # # Call the delete_adaptive_mt_file method. + # result = client.delete_adaptive_mt_file request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Imports an AdaptiveMtFile and adds all of its sentences into the + # AdaptiveMtDataset. + # + # @overload import_adaptive_mt_file(request, options = nil) + # Pass arguments to `import_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) + # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash] + # Inline file source. + # + # Note: The following parameters are mutually exclusive: `file_input_source`, `gcs_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash] + # Google Cloud Storage file source. + # + # Note: The following parameters are mutually exclusive: `gcs_input_source`, `file_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new + # + # # Call the import_adaptive_mt_file method. + # result = client.import_adaptive_mt_file request + # + # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. + # p result + # + def import_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. + # + # @overload list_adaptive_mt_files(request, options = nil) + # Pass arguments to `list_adaptive_mt_files` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @param page_size [::Integer] + # Optional. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtFilesResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtFiles` method. The first page is + # returned if `page_token`is empty or missing. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new + # + # # Call the list_adaptive_mt_files method. + # result = client.list_adaptive_mt_files request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. + # p item + # end + # + def list_adaptive_mt_files request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all AdaptiveMtSentences under a given file/dataset. + # + # @overload list_adaptive_mt_sentences(request, options = nil) + # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. The following format lists all sentences under a file. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # The following format lists all sentences within a dataset. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @param page_size [::Integer] + # @param page_token [::String] + # A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtSentencesRequest.next_page_token returned from the + # previous call to `ListTranslationMemories` method. The first page is + # returned if `page_token` is empty or missing. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new + # + # # Call the list_adaptive_mt_sentences method. + # result = client.list_adaptive_mt_sentences request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. + # p item + # end + # + def list_adaptive_mt_sentences request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Import sentence pairs into translation Dataset. + # + # @overload import_data(request, options = nil) + # Pass arguments to `import_data` via a request object, either of type + # {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import_data(dataset: nil, input_config: nil) + # Pass arguments to `import_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param dataset [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash] + # Required. The config for the input content. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ImportDataRequest.new + # + # # Call the import_data method. + # result = client.import_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.dataset + header_params["dataset"] = request.dataset + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import_data.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :import_data, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports dataset's data to the provided output location. + # + # @overload export_data(request, options = nil) + # Pass arguments to `export_data` via a request object, either of type + # {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload export_data(dataset: nil, output_config: nil) + # Pass arguments to `export_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param dataset [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash] + # Required. The config for the output content. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ExportDataRequest.new + # + # # Call the export_data method. + # result = client.export_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.export_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.dataset + header_params["dataset"] = request.dataset + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.export_data.timeout, + metadata: metadata, + retry_policy: @config.rpcs.export_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :export_data, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists sentence pairs in the dataset. + # + # @overload list_examples(request, options = nil) + # Pass arguments to `list_examples` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_examples` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param filter [::String] + # Optional. An expression for filtering the examples that will be returned. + # Example filter: + # * `usage=TRAIN` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListExamples call. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListExamplesRequest.new + # + # # Call the list_examples method. + # result = client.list_examples request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Example. + # p item + # end + # + def list_examples request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_examples.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_examples.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_examples.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_examples, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_examples, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Model. + # + # @overload create_model(request, options = nil) + # Pass arguments to `create_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_model(parent: nil, model: nil) + # Pass arguments to `create_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name, in form of + # `projects/{project}/locations/{location}` + # @param model [::Google::Cloud::Translate::V3::Model, ::Hash] + # Required. The Model to create. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateModelRequest.new + # + # # Call the create_model method. + # result = client.create_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :create_model, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists models. + # + # @overload list_models(request, options = nil) + # Pass arguments to `list_models` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_models` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param filter [::String] + # Optional. An expression for filtering the models that will be returned. + # Supported filter: + # `dataset_id=${dataset_id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListModels call. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListModelsRequest.new + # + # # Call the list_models method. + # result = client.list_models request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Model. + # p item + # end + # + def list_models request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_models.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_models.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_models.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :list_models, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_models, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a model. + # + # @overload get_model(request, options = nil) + # Pass arguments to `get_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_model(name: nil) + # Pass arguments to `get_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the model to retrieve. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Translate::V3::Model] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Translate::V3::Model] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetModelRequest.new + # + # # Call the get_model method. + # result = client.get_model request + # + # # The returned object is of type Google::Cloud::Translate::V3::Model. + # p result + # + def get_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :get_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a model. + # + # @overload delete_model(request, options = nil) + # Pass arguments to `delete_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_model(name: nil) + # Pass arguments to `delete_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to delete. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteModelRequest.new + # + # # Call the delete_model method. + # result = client.delete_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.call_rpc :delete_model, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the TranslationService API. + # + # This class represents the configuration for TranslationService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # translate_text to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.translate_text.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.translate_text.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "translate.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the TranslationService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `translate_text` + # @return [::Gapic::Config::Method] + # + attr_reader :translate_text + ## + # RPC-specific configuration for `romanize_text` + # @return [::Gapic::Config::Method] + # + attr_reader :romanize_text + ## + # RPC-specific configuration for `detect_language` + # @return [::Gapic::Config::Method] + # + attr_reader :detect_language + ## + # RPC-specific configuration for `get_supported_languages` + # @return [::Gapic::Config::Method] + # + attr_reader :get_supported_languages + ## + # RPC-specific configuration for `translate_document` + # @return [::Gapic::Config::Method] + # + attr_reader :translate_document + ## + # RPC-specific configuration for `batch_translate_text` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_translate_text + ## + # RPC-specific configuration for `batch_translate_document` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_translate_document + ## + # RPC-specific configuration for `create_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :create_glossary + ## + # RPC-specific configuration for `update_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :update_glossary + ## + # RPC-specific configuration for `list_glossaries` + # @return [::Gapic::Config::Method] + # + attr_reader :list_glossaries + ## + # RPC-specific configuration for `get_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :get_glossary + ## + # RPC-specific configuration for `delete_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_glossary + ## + # RPC-specific configuration for `get_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :get_glossary_entry + ## + # RPC-specific configuration for `list_glossary_entries` + # @return [::Gapic::Config::Method] + # + attr_reader :list_glossary_entries + ## + # RPC-specific configuration for `create_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :create_glossary_entry + ## + # RPC-specific configuration for `update_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :update_glossary_entry + ## + # RPC-specific configuration for `delete_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_glossary_entry + ## + # RPC-specific configuration for `create_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :create_dataset + ## + # RPC-specific configuration for `get_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :get_dataset + ## + # RPC-specific configuration for `list_datasets` + # @return [::Gapic::Config::Method] + # + attr_reader :list_datasets + ## + # RPC-specific configuration for `delete_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_dataset + ## + # RPC-specific configuration for `create_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :create_adaptive_mt_dataset + ## + # RPC-specific configuration for `delete_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_adaptive_mt_dataset + ## + # RPC-specific configuration for `get_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :get_adaptive_mt_dataset + ## + # RPC-specific configuration for `list_adaptive_mt_datasets` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_datasets + ## + # RPC-specific configuration for `adaptive_mt_translate` + # @return [::Gapic::Config::Method] + # + attr_reader :adaptive_mt_translate + ## + # RPC-specific configuration for `get_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :get_adaptive_mt_file + ## + # RPC-specific configuration for `delete_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_adaptive_mt_file + ## + # RPC-specific configuration for `import_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :import_adaptive_mt_file + ## + # RPC-specific configuration for `list_adaptive_mt_files` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_files + ## + # RPC-specific configuration for `list_adaptive_mt_sentences` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_sentences + ## + # RPC-specific configuration for `import_data` + # @return [::Gapic::Config::Method] + # + attr_reader :import_data + ## + # RPC-specific configuration for `export_data` + # @return [::Gapic::Config::Method] + # + attr_reader :export_data + ## + # RPC-specific configuration for `list_examples` + # @return [::Gapic::Config::Method] + # + attr_reader :list_examples + ## + # RPC-specific configuration for `create_model` + # @return [::Gapic::Config::Method] + # + attr_reader :create_model + ## + # RPC-specific configuration for `list_models` + # @return [::Gapic::Config::Method] + # + attr_reader :list_models + ## + # RPC-specific configuration for `get_model` + # @return [::Gapic::Config::Method] + # + attr_reader :get_model + ## + # RPC-specific configuration for `delete_model` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_model + + # @private + def initialize parent_rpcs = nil + translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text + @translate_text = ::Gapic::Config::Method.new translate_text_config + romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text + @romanize_text = ::Gapic::Config::Method.new romanize_text_config + detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language + @detect_language = ::Gapic::Config::Method.new detect_language_config + get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages + @get_supported_languages = ::Gapic::Config::Method.new get_supported_languages_config + translate_document_config = parent_rpcs.translate_document if parent_rpcs.respond_to? :translate_document + @translate_document = ::Gapic::Config::Method.new translate_document_config + batch_translate_text_config = parent_rpcs.batch_translate_text if parent_rpcs.respond_to? :batch_translate_text + @batch_translate_text = ::Gapic::Config::Method.new batch_translate_text_config + batch_translate_document_config = parent_rpcs.batch_translate_document if parent_rpcs.respond_to? :batch_translate_document + @batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config + create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary + @create_glossary = ::Gapic::Config::Method.new create_glossary_config + update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary + @update_glossary = ::Gapic::Config::Method.new update_glossary_config + list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries + @list_glossaries = ::Gapic::Config::Method.new list_glossaries_config + get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary + @get_glossary = ::Gapic::Config::Method.new get_glossary_config + delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary + @delete_glossary = ::Gapic::Config::Method.new delete_glossary_config + get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry + @get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config + list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries + @list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config + create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry + @create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config + update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry + @update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config + delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry + @delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config + create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset + @create_dataset = ::Gapic::Config::Method.new create_dataset_config + get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset + @get_dataset = ::Gapic::Config::Method.new get_dataset_config + list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets + @list_datasets = ::Gapic::Config::Method.new list_datasets_config + delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset + @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config + create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset + @create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config + delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset + @delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config + get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset + @get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config + list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets + @list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config + adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate + @adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config + get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file + @get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config + delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file + @delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config + import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file + @import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config + list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files + @list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config + list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences + @list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config + import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data + @import_data = ::Gapic::Config::Method.new import_data_config + export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data + @export_data = ::Gapic::Config::Method.new export_data_config + list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples + @list_examples = ::Gapic::Config::Method.new list_examples_config + create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model + @create_model = ::Gapic::Config::Method.new create_model_config + list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models + @list_models = ::Gapic::Config::Method.new list_models_config + get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model + @get_model = ::Gapic::Config::Method.new get_model_config + delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model + @delete_model = ::Gapic::Config::Method.new delete_model_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb new file mode 100644 index 000000000000..8cca11bc3a91 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + # Credentials for the TranslationService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-translation" + ] + self.env_vars = [ + "TRANSLATE_CREDENTIALS", + "TRANSLATE_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "TRANSLATE_CREDENTIALS_JSON", + "TRANSLATE_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb new file mode 100644 index 000000000000..6bd74364f287 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb @@ -0,0 +1,849 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the TranslationService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the TranslationService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "translate.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb new file mode 100644 index 000000000000..1f51c2c96070 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + module TranslationService + # Path helper methods for the TranslationService API. + module Paths + ## + # Create a fully-qualified AdaptiveMtDataset resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # + # @param project [String] + # @param location [String] + # @param dataset [String] + # + # @return [::String] + def adaptive_mt_dataset_path project:, location:, dataset: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/adaptiveMtDatasets/#{dataset}" + end + + ## + # Create a fully-qualified AdaptiveMtFile resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # + # @param project [String] + # @param location [String] + # @param dataset [String] + # @param file [String] + # + # @return [::String] + def adaptive_mt_file_path project:, location:, dataset:, file: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/" + + "projects/#{project}/locations/#{location}/adaptiveMtDatasets/#{dataset}/adaptiveMtFiles/#{file}" + end + + ## + # Create a fully-qualified Dataset resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/datasets/{dataset}` + # + # @param project [String] + # @param location [String] + # @param dataset [String] + # + # @return [::String] + def dataset_path project:, location:, dataset: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/datasets/#{dataset}" + end + + ## + # Create a fully-qualified Glossary resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/glossaries/{glossary}` + # + # @param project [String] + # @param location [String] + # @param glossary [String] + # + # @return [::String] + def glossary_path project:, location:, glossary: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/glossaries/#{glossary}" + end + + ## + # Create a fully-qualified GlossaryEntry resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/glossaries/{glossary}/glossaryEntries/{glossary_entry}` + # + # @param project [String] + # @param location [String] + # @param glossary [String] + # @param glossary_entry [String] + # + # @return [::String] + def glossary_entry_path project:, location:, glossary:, glossary_entry: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "glossary cannot contain /" if glossary.to_s.include? "/" + + "projects/#{project}/locations/#{location}/glossaries/#{glossary}/glossaryEntries/#{glossary_entry}" + end + + ## + # Create a fully-qualified Location resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}` + # + # @param project [String] + # @param location [String] + # + # @return [::String] + def location_path project:, location: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/locations/#{location}" + end + + ## + # Create a fully-qualified Model resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/models/{model}` + # + # @param project [String] + # @param location [String] + # @param model [String] + # + # @return [::String] + def model_path project:, location:, model: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/models/#{model}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb new file mode 100644 index 000000000000..7aa1906ff964 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/translate/v3/version" +require "google/cloud/translate/v3/bindings_override" + +require "google/cloud/translate/v3/translation_service/credentials" +require "google/cloud/translate/v3/translation_service/paths" +require "google/cloud/translate/v3/translation_service/rest/operations" +require "google/cloud/translate/v3/translation_service/rest/client" + +module Google + module Cloud + module Translate + module V3 + ## + # Provides natural language translation operations. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/translate/v3/translation_service/rest" + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + module TranslationService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/translate/v3/translation_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb new file mode 100644 index 000000000000..c04f4cf27519 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb @@ -0,0 +1,4315 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/translate/v3/translation_service_pb" +require "google/cloud/translate/v3/translation_service/rest/service_stub" +require "google/cloud/location/rest" +require "google/iam/v1/rest" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + module Rest + ## + # REST client for the TranslationService service. + # + # Provides natural language translation operations. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :translation_service_stub + + ## + # Configure the TranslationService Client class. + # + # See {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all TranslationService clients + # ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Translate", "V3"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.translate_text.timeout = 600.0 + + default_config.rpcs.detect_language.timeout = 600.0 + + default_config.rpcs.get_supported_languages.timeout = 600.0 + default_config.rpcs.get_supported_languages.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.translate_document.timeout = 600.0 + + default_config.rpcs.batch_translate_text.timeout = 600.0 + + default_config.rpcs.batch_translate_document.timeout = 600.0 + + default_config.rpcs.create_glossary.timeout = 600.0 + + default_config.rpcs.list_glossaries.timeout = 600.0 + default_config.rpcs.list_glossaries.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.get_glossary.timeout = 600.0 + default_config.rpcs.get_glossary.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config.rpcs.delete_glossary.timeout = 600.0 + default_config.rpcs.delete_glossary.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the TranslationService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @translation_service_stub.universe_domain + end + + ## + # Create a new TranslationService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the TranslationService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @translation_service_stub = ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @translation_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @translation_service_stub.endpoint + config.universe_domain = @translation_service_stub.universe_domain + config.bindings_override = @config.bindings_override + config.logger = @translation_service_stub.logger if config.respond_to? :logger= + end + + @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @translation_service_stub.endpoint + config.universe_domain = @translation_service_stub.universe_domain + config.logger = @translation_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Translate::V3::TranslationService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # Get the associated client for mix-in of the IAMPolicy. + # + # @return [Google::Iam::V1::IAMPolicy::Rest::Client] + # + attr_reader :iam_policy_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @translation_service_stub.logger + end + + # Service calls + + ## + # Translates input text and returns translated text. + # + # @overload translate_text(request, options = nil) + # Pass arguments to `translate_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::TranslateTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::TranslateTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) + # Pass arguments to `translate_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param contents [::Array<::String>] + # Required. The content of the input in string format. + # We recommend the total content be less than 30,000 codepoints. The max + # length of this field is 1024. Use BatchTranslateText for larger text. + # @param mime_type [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @param source_language_code [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "en-US" or "sr-Latn". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). If the source + # language isn't specified, the API attempts to identify the source language + # automatically and returns the source language within the response. + # @param target_language_code [::String] + # Required. The ISO-639 language code to use for translation of the input + # text, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 same + # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + # @param model [::String] + # 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`, + # + # - Translation LLM models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, + # + # For global (non-regionalized) requests, use `location-id` `global`. + # For example, + # `projects/{project-number-or-id}/locations/global/models/general/nmt`. + # + # If not provided, the default Google model (NMT) will be used + # @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] + # 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 transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash] + # Optional. Transliteration to be applied. + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::TranslateTextResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::TranslateTextRequest.new + # + # # Call the translate_text method. + # result = client.translate_text request + # + # # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. + # p result + # + def translate_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.translate_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.translate_text.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.translate_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.translate_text request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Romanize input text written in non-Latin scripts to Latin text. + # + # @overload romanize_text(request, options = nil) + # Pass arguments to `romanize_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload romanize_text(parent: nil, contents: nil, source_language_code: nil) + # Pass arguments to `romanize_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # @param contents [::Array<::String>] + # Required. The content of the input in string format. + # @param source_language_code [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "hi" or "zh". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages#roman). If the + # source language isn't specified, the API attempts to identify the source + # language automatically and returns the source language for each content in + # the response. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::RomanizeTextRequest.new + # + # # Call the romanize_text method. + # result = client.romanize_text request + # + # # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. + # p result + # + def romanize_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.romanize_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.romanize_text.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.romanize_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.romanize_text request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Detects the language of text within a request. + # + # @overload detect_language(request, options = nil) + # Pass arguments to `detect_language` via a request object, either of type + # {::Google::Cloud::Translate::V3::DetectLanguageRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) + # Pass arguments to `detect_language` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # + # Only models within the same region (has same location-id) can be used. + # Otherwise an INVALID_ARGUMENT (400) error is returned. + # @param model [::String] + # Optional. The language detection model to be used. + # + # Format: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + # + # Only one language detection model is currently supported: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + # + # If not specified, the default model is used. + # @param content [::String] + # The content of the input stored as a string. + # @param mime_type [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DetectLanguageRequest.new + # + # # Call the detect_language method. + # result = client.detect_language request + # + # # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. + # p result + # + def detect_language request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DetectLanguageRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.detect_language.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.detect_language.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.detect_language.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.detect_language request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns a list of supported languages for translation. + # + # @overload get_supported_languages(request, options = nil) + # Pass arguments to `get_supported_languages` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_supported_languages(parent: nil, display_language_code: nil, model: nil) + # Pass arguments to `get_supported_languages` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 AutoML models. + # + # Only models within the same region (have same location-id) can be used, + # otherwise an INVALID_ARGUMENT (400) error is returned. + # @param display_language_code [::String] + # Optional. The language to use to return localized, human readable names + # of supported languages. If missing, then display names are not returned + # in a response. + # @param model [::String] + # Optional. Get supported languages of this model. + # + # 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`, + # + # + # Returns languages supported by the specified model. + # If missing, we get supported languages of Google general NMT model. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::SupportedLanguages] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::SupportedLanguages] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new + # + # # Call the get_supported_languages method. + # result = client.get_supported_languages request + # + # # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. + # p result + # + def get_supported_languages request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_supported_languages.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_supported_languages.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_supported_languages.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_supported_languages request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Translates documents in synchronous mode. + # + # @overload translate_document(request, options = nil) + # Pass arguments to `translate_document` via a request object, either of type + # {::Google::Cloud::Translate::V3::TranslateDocumentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) + # Pass arguments to `translate_document` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # 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 source_language_code [::String] + # Optional. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). 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 target_language_code [::String] + # Required. The ISO-639 language code to use for translation of the input + # document, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash] + # Required. Input configurations. + # @param document_output_config [::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash] + # 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 model [::String] + # 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 glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] + # 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 labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters (Unicode + # codepoints), can only contain lowercase letters, numeric characters, + # underscores and dashes. International characters are allowed. Label values + # are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @param customized_attribution [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @param is_translate_native_pdf_only [::Boolean] + # Optional. is_translate_native_pdf_only field for external customers. + # If true, the page limit of online native pdf translation is 300 and only + # native pdf pages will be translated. + # @param enable_shadow_removal_native_pdf [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @param enable_rotation_correction [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new + # + # # Call the translate_document method. + # result = client.translate_document request + # + # # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. + # p result + # + def translate_document request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateDocumentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.translate_document.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.translate_document.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.translate_document.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.translate_document request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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 + # 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. + # + # @overload batch_translate_text(request, options = nil) + # Pass arguments to `batch_translate_text` via a request object, either of type + # {::Google::Cloud::Translate::V3::BatchTranslateTextRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) + # Pass arguments to `batch_translate_text` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Location to make a call. Must refer to a caller's project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # + # The `global` location is not supported for batch translation. + # + # Only AutoML Translation models or glossaries within the same region (have + # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + # error is returned. + # @param source_language_code [::String] + # Required. Source language code. Supported language codes are listed in + # [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param target_language_codes [::Array<::String>] + # Required. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param models [::Hash{::String => ::String}] + # Optional. The models to use for translation. Map's key is target language + # code. Map's value is model name. Value can be a built-in general model, + # or an AutoML Translation model. + # + # The value format depends on model type: + # + # - AutoML Translation models: + # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + # + # - General (built-in) models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + # + # + # If the map is empty or a specific model is + # not requested for a language pair, then default google model (nmt) is used. + # @param input_configs [::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>] + # Required. Input configurations. + # The total number of files matched should be <= 100. + # The total content size should be <= 100M Unicode codepoints. + # The files must use UTF-8 encoding. + # @param output_config [::Google::Cloud::Translate::V3::OutputConfig, ::Hash] + # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] + # Optional. Glossaries to be applied for translation. + # It's keyed by target language code. + # @param labels [::Hash{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new + # + # # Call the batch_translate_text method. + # result = client.batch_translate_text request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def batch_translate_text request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateTextRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.batch_translate_text.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.batch_translate_text.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.batch_translate_text.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.batch_translate_text request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # 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. + # + # @overload batch_translate_document(request, options = nil) + # Pass arguments to `batch_translate_document` via a request object, either of type + # {::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) + # Pass arguments to `batch_translate_document` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # 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 source_language_code [::String] + # Required. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). + # @param target_language_codes [::Array<::String>] + # Required. The ISO-639 language code to use for translation of the input + # document. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>] + # 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 output_config [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig, ::Hash] + # 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 models [::Hash{::String => ::String}] + # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] + # Optional. Glossaries to be applied. It's keyed by target language code. + # @param format_conversions [::Hash{::String => ::String}] + # Optional. The file format conversion map that is applied to all input + # files. The map key is the original mime_type. The map 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 customized_attribution [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @param enable_shadow_removal_native_pdf [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @param enable_rotation_correction [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new + # + # # Call the batch_translate_document method. + # result = client.batch_translate_document request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def batch_translate_document request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.batch_translate_document.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.batch_translate_document.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.batch_translate_document.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.batch_translate_document request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a glossary and returns the long-running operation. Returns + # NOT_FOUND, if the project doesn't exist. + # + # @overload create_glossary(request, options = nil) + # Pass arguments to `create_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_glossary(parent: nil, glossary: nil) + # Pass arguments to `create_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name. + # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] + # Required. The glossary to create. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new + # + # # Call the create_glossary method. + # result = client.create_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_glossary.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.create_glossary request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a glossary. A LRO is used since the update can be async if the + # glossary's entry file is updated. + # + # @overload update_glossary(request, options = nil) + # Pass arguments to `update_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_glossary(glossary: nil, update_mask: nil) + # Pass arguments to `update_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] + # Required. The glossary entry to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # The list of fields to be updated. Currently only `display_name` and + # 'input_config' + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new + # + # # Call the update_glossary method. + # result = client.update_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def update_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_glossary.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.update_glossary request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + # exist. + # + # @overload list_glossaries(request, options = nil) + # Pass arguments to `list_glossaries` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListGlossariesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_glossaries` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The name of the project from which to list all of the glossaries. + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer glossaries than + # requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of [ListGlossariesResponse.next_page_token] + # returned from the previous call to `ListGlossaries` method. + # The first page is returned if `page_token`is empty or missing. + # @param filter [::String] + # Optional. Filter specifying constraints of a list operation. + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListGlossariesRequest.new + # + # # Call the list_glossaries method. + # result = client.list_glossaries request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Glossary. + # p item + # end + # + def list_glossaries request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossariesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_glossaries.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_glossaries.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_glossaries.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_glossaries request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossaries, "glossaries", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + # exist. + # + # @overload get_glossary(request, options = nil) + # Pass arguments to `get_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_glossary(name: nil) + # Pass arguments to `get_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the glossary to retrieve. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Glossary] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Glossary] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetGlossaryRequest.new + # + # # Call the get_glossary method. + # result = client.get_glossary request + # + # # The returned object is of type Google::Cloud::Translate::V3::Glossary. + # p result + # + def get_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_glossary.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_glossary request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a glossary, or cancels glossary construction + # if the glossary isn't created yet. + # Returns NOT_FOUND, if the glossary doesn't exist. + # + # @overload delete_glossary(request, options = nil) + # Pass arguments to `delete_glossary` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteGlossaryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_glossary(name: nil) + # Pass arguments to `delete_glossary` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the glossary to delete. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new + # + # # Call the delete_glossary method. + # result = client.delete_glossary request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_glossary request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_glossary.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_glossary.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_glossary.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_glossary request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a single glossary entry by the given id. + # + # @overload get_glossary_entry(request, options = nil) + # Pass arguments to `get_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_glossary_entry(name: nil) + # Pass arguments to `get_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the glossary entry to get + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new + # + # # Call the get_glossary_entry method. + # result = client.get_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def get_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_glossary_entry request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # List the entries for the glossary. + # + # @overload list_glossary_entries(request, options = nil) + # Pass arguments to `list_glossary_entries` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_glossary_entries` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent glossary resource name for listing the glossary's + # entries. + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer glossary entries + # than requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # [ListGlossaryEntriesResponse.next_page_token] returned from the previous + # call. The first page is returned if `page_token`is empty or missing. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new + # + # # Call the list_glossary_entries method. + # result = client.list_glossary_entries request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. + # p item + # end + # + def list_glossary_entries request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_glossary_entries.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_glossary_entries.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_glossary_entries request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, "glossary_entries", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a glossary entry. + # + # @overload create_glossary_entry(request, options = nil) + # Pass arguments to `create_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_glossary_entry(parent: nil, glossary_entry: nil) + # Pass arguments to `create_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the glossary to create the entry under. + # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] + # Required. The glossary entry to create + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new + # + # # Call the create_glossary_entry method. + # result = client.create_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def create_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.create_glossary_entry request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a glossary entry. + # + # @overload update_glossary_entry(request, options = nil) + # Pass arguments to `update_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_glossary_entry(glossary_entry: nil) + # Pass arguments to `update_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] + # Required. The glossary entry to update. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new + # + # # Call the update_glossary_entry method. + # result = client.update_glossary_entry request + # + # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + # p result + # + def update_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.update_glossary_entry request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a single entry from the glossary + # + # @overload delete_glossary_entry(request, options = nil) + # Pass arguments to `delete_glossary_entry` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_glossary_entry(name: nil) + # Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the glossary entry to delete + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new + # + # # Call the delete_glossary_entry method. + # result = client.delete_glossary_entry request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_glossary_entry request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_glossary_entry.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_glossary_entry.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_glossary_entry request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Dataset. + # + # @overload create_dataset(request, options = nil) + # Pass arguments to `create_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_dataset(parent: nil, dataset: nil) + # Pass arguments to `create_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name. + # @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash] + # Required. The Dataset to create. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateDatasetRequest.new + # + # # Call the create_dataset method. + # result = client.create_dataset request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.create_dataset request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Dataset. + # + # @overload get_dataset(request, options = nil) + # Pass arguments to `get_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_dataset(name: nil) + # Pass arguments to `get_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the dataset to retrieve. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Dataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Dataset] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetDatasetRequest.new + # + # # Call the get_dataset method. + # result = client.get_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::Dataset. + # p result + # + def get_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_dataset request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists datasets. + # + # @overload list_datasets(request, options = nil) + # Pass arguments to `list_datasets` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_datasets(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_datasets` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListDatasets call. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListDatasetsRequest.new + # + # # Call the list_datasets method. + # result = client.list_datasets request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Dataset. + # p item + # end + # + def list_datasets request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_datasets.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_datasets.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_datasets.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_datasets request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_datasets, "datasets", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a dataset and all of its contents. + # + # @overload delete_dataset(request, options = nil) + # Pass arguments to `delete_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_dataset(name: nil) + # Pass arguments to `delete_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the dataset to delete. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new + # + # # Call the delete_dataset method. + # result = client.delete_dataset request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_dataset request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates an Adaptive MT dataset. + # + # @overload create_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) + # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash] + # Required. The AdaptiveMtDataset to be created. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new + # + # # Call the create_adaptive_mt_dataset method. + # result = client.create_adaptive_mt_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p result + # + def create_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an Adaptive MT dataset, including all its entries and associated + # metadata. + # + # @overload delete_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_adaptive_mt_dataset(name: nil) + # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new + # + # # Call the delete_adaptive_mt_dataset method. + # result = client.delete_adaptive_mt_dataset request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the Adaptive MT dataset. + # + # @overload get_adaptive_mt_dataset(request, options = nil) + # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_adaptive_mt_dataset(name: nil) + # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new + # + # # Call the get_adaptive_mt_dataset method. + # result = client.get_adaptive_mt_dataset request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p result + # + def get_adaptive_mt_dataset request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all Adaptive MT datasets for which the caller has read permission. + # + # @overload list_adaptive_mt_datasets(request, options = nil) + # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server may return fewer results than + # requested. If unspecified, the server picks an appropriate default. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtDatasetsResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtDatasets` method. The first page is + # returned if `page_token`is empty or missing. + # @param filter [::String] + # Optional. An expression for filtering the results of the request. + # Filter is not supported yet. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new + # + # # Call the list_adaptive_mt_datasets method. + # result = client.list_adaptive_mt_datasets request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. + # p item + # end + # + def list_adaptive_mt_datasets request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Translate text using Adaptive MT. + # + # @overload adaptive_mt_translate(request, options = nil) + # Pass arguments to `adaptive_mt_translate` via a request object, either of type + # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) + # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Location to make a regional call. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # @param dataset [::String] + # Required. The resource name for the dataset to use for adaptive MT. + # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + # @param content [::Array<::String>] + # Required. The content of the input in string format. + # @param mime_type [::String] + # The format of the source text. + # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] + # Configuration for caller provided reference sentences. + # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] + # 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. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new + # + # # Call the adaptive_mt_translate method. + # result = client.adaptive_mt_translate request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. + # p result + # + def adaptive_mt_translate request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.adaptive_mt_translate request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets and AdaptiveMtFile + # + # @overload get_adaptive_mt_file(request, options = nil) + # Pass arguments to `get_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_adaptive_mt_file(name: nil) + # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new + # + # # Call the get_adaptive_mt_file method. + # result = client.get_adaptive_mt_file request + # + # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. + # p result + # + def get_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_adaptive_mt_file request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an AdaptiveMtFile along with its sentences. + # + # @overload delete_adaptive_mt_file(request, options = nil) + # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_adaptive_mt_file(name: nil) + # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the file to delete, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new + # + # # Call the delete_adaptive_mt_file method. + # result = client.delete_adaptive_mt_file request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_adaptive_mt_file request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Imports an AdaptiveMtFile and adds all of its sentences into the + # AdaptiveMtDataset. + # + # @overload import_adaptive_mt_file(request, options = nil) + # Pass arguments to `import_adaptive_mt_file` via a request object, either of type + # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) + # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash] + # Inline file source. + # + # Note: The following parameters are mutually exclusive: `file_input_source`, `gcs_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash] + # Google Cloud Storage file source. + # + # Note: The following parameters are mutually exclusive: `gcs_input_source`, `file_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new + # + # # Call the import_adaptive_mt_file method. + # result = client.import_adaptive_mt_file request + # + # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. + # p result + # + def import_adaptive_mt_file request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.import_adaptive_mt_file request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. + # + # @overload list_adaptive_mt_files(request, options = nil) + # Pass arguments to `list_adaptive_mt_files` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @param page_size [::Integer] + # Optional. + # @param page_token [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtFilesResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtFiles` method. The first page is + # returned if `page_token`is empty or missing. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new + # + # # Call the list_adaptive_mt_files method. + # result = client.list_adaptive_mt_files request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. + # p item + # end + # + def list_adaptive_mt_files request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_adaptive_mt_files request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all AdaptiveMtSentences under a given file/dataset. + # + # @overload list_adaptive_mt_sentences(request, options = nil) + # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. The following format lists all sentences under a file. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # The following format lists all sentences within a dataset. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @param page_size [::Integer] + # @param page_token [::String] + # A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtSentencesRequest.next_page_token returned from the + # previous call to `ListTranslationMemories` method. The first page is + # returned if `page_token` is empty or missing. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new + # + # # Call the list_adaptive_mt_sentences method. + # result = client.list_adaptive_mt_sentences request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. + # p item + # end + # + def list_adaptive_mt_sentences request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Import sentence pairs into translation Dataset. + # + # @overload import_data(request, options = nil) + # Pass arguments to `import_data` via a request object, either of type + # {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import_data(dataset: nil, input_config: nil) + # Pass arguments to `import_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param dataset [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash] + # Required. The config for the input content. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ImportDataRequest.new + # + # # Call the import_data method. + # result = client.import_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import_data.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.import_data request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports dataset's data to the provided output location. + # + # @overload export_data(request, options = nil) + # Pass arguments to `export_data` via a request object, either of type + # {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload export_data(dataset: nil, output_config: nil) + # Pass arguments to `export_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param dataset [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash] + # Required. The config for the output content. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ExportDataRequest.new + # + # # Call the export_data method. + # result = client.export_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.export_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.export_data.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.export_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.export_data request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists sentence pairs in the dataset. + # + # @overload list_examples(request, options = nil) + # Pass arguments to `list_examples` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_examples` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @param filter [::String] + # Optional. An expression for filtering the examples that will be returned. + # Example filter: + # * `usage=TRAIN` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListExamples call. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListExamplesRequest.new + # + # # Call the list_examples method. + # result = client.list_examples request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Example. + # p item + # end + # + def list_examples request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_examples.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_examples.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_examples.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_examples request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_examples, "examples", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Creates a Model. + # + # @overload create_model(request, options = nil) + # Pass arguments to `create_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_model(parent: nil, model: nil) + # Pass arguments to `create_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The project name, in form of + # `projects/{project}/locations/{location}` + # @param model [::Google::Cloud::Translate::V3::Model, ::Hash] + # Required. The Model to create. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::CreateModelRequest.new + # + # # Call the create_model method. + # result = client.create_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.create_model request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists models. + # + # @overload list_models(request, options = nil) + # Pass arguments to `list_models` via a request object, either of type + # {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_models` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @param filter [::String] + # Optional. An expression for filtering the models that will be returned. + # Supported filter: + # `dataset_id=${dataset_id}` + # @param page_size [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @param page_token [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListModels call. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::ListModelsRequest.new + # + # # Call the list_models method. + # result = client.list_models request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Translate::V3::Model. + # p item + # end + # + def list_models request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_models.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_models.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_models.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.list_models request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_models, "models", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a model. + # + # @overload get_model(request, options = nil) + # Pass arguments to `get_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_model(name: nil) + # Pass arguments to `get_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the model to retrieve. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Model] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::GetModelRequest.new + # + # # Call the get_model method. + # result = client.get_model request + # + # # The returned object is of type Google::Cloud::Translate::V3::Model. + # p result + # + def get_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.get_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a model. + # + # @overload delete_model(request, options = nil) + # Pass arguments to `delete_model` via a request object, either of type + # {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_model(name: nil) + # Pass arguments to `delete_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to delete. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/translate/v3" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Translate::V3::DeleteModelRequest.new + # + # # Call the delete_model method. + # result = client.delete_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @translation_service_stub.delete_model request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the TranslationService REST API. + # + # This class represents the configuration for TranslationService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # translate_text to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.translate_text.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.translate_text.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "translate.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + # Overrides for http bindings for the RPCs of this service + # are only used when this service is used as mixin, and only + # by the host service. + # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] + config_attr :bindings_override, {}, ::Hash, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the TranslationService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `translate_text` + # @return [::Gapic::Config::Method] + # + attr_reader :translate_text + ## + # RPC-specific configuration for `romanize_text` + # @return [::Gapic::Config::Method] + # + attr_reader :romanize_text + ## + # RPC-specific configuration for `detect_language` + # @return [::Gapic::Config::Method] + # + attr_reader :detect_language + ## + # RPC-specific configuration for `get_supported_languages` + # @return [::Gapic::Config::Method] + # + attr_reader :get_supported_languages + ## + # RPC-specific configuration for `translate_document` + # @return [::Gapic::Config::Method] + # + attr_reader :translate_document + ## + # RPC-specific configuration for `batch_translate_text` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_translate_text + ## + # RPC-specific configuration for `batch_translate_document` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_translate_document + ## + # RPC-specific configuration for `create_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :create_glossary + ## + # RPC-specific configuration for `update_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :update_glossary + ## + # RPC-specific configuration for `list_glossaries` + # @return [::Gapic::Config::Method] + # + attr_reader :list_glossaries + ## + # RPC-specific configuration for `get_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :get_glossary + ## + # RPC-specific configuration for `delete_glossary` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_glossary + ## + # RPC-specific configuration for `get_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :get_glossary_entry + ## + # RPC-specific configuration for `list_glossary_entries` + # @return [::Gapic::Config::Method] + # + attr_reader :list_glossary_entries + ## + # RPC-specific configuration for `create_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :create_glossary_entry + ## + # RPC-specific configuration for `update_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :update_glossary_entry + ## + # RPC-specific configuration for `delete_glossary_entry` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_glossary_entry + ## + # RPC-specific configuration for `create_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :create_dataset + ## + # RPC-specific configuration for `get_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :get_dataset + ## + # RPC-specific configuration for `list_datasets` + # @return [::Gapic::Config::Method] + # + attr_reader :list_datasets + ## + # RPC-specific configuration for `delete_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_dataset + ## + # RPC-specific configuration for `create_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :create_adaptive_mt_dataset + ## + # RPC-specific configuration for `delete_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_adaptive_mt_dataset + ## + # RPC-specific configuration for `get_adaptive_mt_dataset` + # @return [::Gapic::Config::Method] + # + attr_reader :get_adaptive_mt_dataset + ## + # RPC-specific configuration for `list_adaptive_mt_datasets` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_datasets + ## + # RPC-specific configuration for `adaptive_mt_translate` + # @return [::Gapic::Config::Method] + # + attr_reader :adaptive_mt_translate + ## + # RPC-specific configuration for `get_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :get_adaptive_mt_file + ## + # RPC-specific configuration for `delete_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_adaptive_mt_file + ## + # RPC-specific configuration for `import_adaptive_mt_file` + # @return [::Gapic::Config::Method] + # + attr_reader :import_adaptive_mt_file + ## + # RPC-specific configuration for `list_adaptive_mt_files` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_files + ## + # RPC-specific configuration for `list_adaptive_mt_sentences` + # @return [::Gapic::Config::Method] + # + attr_reader :list_adaptive_mt_sentences + ## + # RPC-specific configuration for `import_data` + # @return [::Gapic::Config::Method] + # + attr_reader :import_data + ## + # RPC-specific configuration for `export_data` + # @return [::Gapic::Config::Method] + # + attr_reader :export_data + ## + # RPC-specific configuration for `list_examples` + # @return [::Gapic::Config::Method] + # + attr_reader :list_examples + ## + # RPC-specific configuration for `create_model` + # @return [::Gapic::Config::Method] + # + attr_reader :create_model + ## + # RPC-specific configuration for `list_models` + # @return [::Gapic::Config::Method] + # + attr_reader :list_models + ## + # RPC-specific configuration for `get_model` + # @return [::Gapic::Config::Method] + # + attr_reader :get_model + ## + # RPC-specific configuration for `delete_model` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_model + + # @private + def initialize parent_rpcs = nil + translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text + @translate_text = ::Gapic::Config::Method.new translate_text_config + romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text + @romanize_text = ::Gapic::Config::Method.new romanize_text_config + detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language + @detect_language = ::Gapic::Config::Method.new detect_language_config + get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages + @get_supported_languages = ::Gapic::Config::Method.new get_supported_languages_config + translate_document_config = parent_rpcs.translate_document if parent_rpcs.respond_to? :translate_document + @translate_document = ::Gapic::Config::Method.new translate_document_config + batch_translate_text_config = parent_rpcs.batch_translate_text if parent_rpcs.respond_to? :batch_translate_text + @batch_translate_text = ::Gapic::Config::Method.new batch_translate_text_config + batch_translate_document_config = parent_rpcs.batch_translate_document if parent_rpcs.respond_to? :batch_translate_document + @batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config + create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary + @create_glossary = ::Gapic::Config::Method.new create_glossary_config + update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary + @update_glossary = ::Gapic::Config::Method.new update_glossary_config + list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries + @list_glossaries = ::Gapic::Config::Method.new list_glossaries_config + get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary + @get_glossary = ::Gapic::Config::Method.new get_glossary_config + delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary + @delete_glossary = ::Gapic::Config::Method.new delete_glossary_config + get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry + @get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config + list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries + @list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config + create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry + @create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config + update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry + @update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config + delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry + @delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config + create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset + @create_dataset = ::Gapic::Config::Method.new create_dataset_config + get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset + @get_dataset = ::Gapic::Config::Method.new get_dataset_config + list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets + @list_datasets = ::Gapic::Config::Method.new list_datasets_config + delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset + @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config + create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset + @create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config + delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset + @delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config + get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset + @get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config + list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets + @list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config + adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate + @adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config + get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file + @get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config + delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file + @delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config + import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file + @import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config + list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files + @list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config + list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences + @list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config + import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data + @import_data = ::Gapic::Config::Method.new import_data_config + export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data + @export_data = ::Gapic::Config::Method.new export_data_config + list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples + @list_examples = ::Gapic::Config::Method.new list_examples_config + create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model + @create_model = ::Gapic::Config::Method.new create_model_config + list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models + @list_models = ::Gapic::Config::Method.new list_models_config + get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model + @get_model = ::Gapic::Config::Method.new get_model_config + delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model + @delete_model = ::Gapic::Config::Method.new delete_model_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb new file mode 100644 index 000000000000..fe150ccbe903 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb @@ -0,0 +1,1093 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the TranslationService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the TranslationService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Translate::V3::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.wait_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "translate.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the wait_operation REST call + # + # @param request_pb [::Google::Longrunning::WaitOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def wait_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_wait_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "wait_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the wait_operation REST call + # + # @param request_pb [::Google::Longrunning::WaitOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_wait_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{name}:wait", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb new file mode 100644 index 000000000000..2bee326ee72a --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb @@ -0,0 +1,2454 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/translate/v3/translation_service_pb" + +module Google + module Cloud + module Translate + module V3 + module TranslationService + module Rest + ## + # REST service stub for the TranslationService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the translate_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::TranslateTextRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::TranslateTextResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] + # A result object deserialized from the server's reply + def translate_text request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_translate_text_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "translate_text", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::TranslateTextResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the romanize_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::RomanizeTextRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] + # A result object deserialized from the server's reply + def romanize_text request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_romanize_text_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "romanize_text", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::RomanizeTextResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the detect_language REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DetectLanguageRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] + # A result object deserialized from the server's reply + def detect_language request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_detect_language_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "detect_language", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::DetectLanguageResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_supported_languages REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::SupportedLanguages] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::SupportedLanguages] + # A result object deserialized from the server's reply + def get_supported_languages request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_supported_languages_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_supported_languages", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::SupportedLanguages.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the translate_document REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::TranslateDocumentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] + # A result object deserialized from the server's reply + def translate_document request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_translate_document_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "translate_document", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the batch_translate_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateTextRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def batch_translate_text request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_batch_translate_text_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "batch_translate_text", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the batch_translate_document REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def batch_translate_document request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_batch_translate_document_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "batch_translate_document", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_glossary request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_glossary_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_glossary", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def update_glossary request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_glossary_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_glossary", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_glossaries REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListGlossariesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListGlossariesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListGlossariesResponse] + # A result object deserialized from the server's reply + def list_glossaries request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_glossaries_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_glossaries", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListGlossariesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Glossary] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Glossary] + # A result object deserialized from the server's reply + def get_glossary request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_glossary_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_glossary", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::Glossary.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_glossary request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_glossary_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_glossary", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # A result object deserialized from the server's reply + def get_glossary_entry request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_glossary_entry_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_glossary_entry", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_glossary_entries REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse] + # A result object deserialized from the server's reply + def list_glossary_entries request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_glossary_entries_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_glossary_entries", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # A result object deserialized from the server's reply + def create_glossary_entry request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_glossary_entry_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_glossary_entry", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # A result object deserialized from the server's reply + def update_glossary_entry request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_glossary_entry_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_glossary_entry", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_glossary_entry request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_glossary_entry_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_glossary_entry", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Dataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Dataset] + # A result object deserialized from the server's reply + def get_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::Dataset.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_datasets REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListDatasetsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListDatasetsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListDatasetsResponse] + # A result object deserialized from the server's reply + def list_datasets request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_datasets_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_datasets", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # A result object deserialized from the server's reply + def create_adaptive_mt_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_adaptive_mt_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_adaptive_mt_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_adaptive_mt_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_adaptive_mt_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_adaptive_mt_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # A result object deserialized from the server's reply + def get_adaptive_mt_dataset request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_adaptive_mt_dataset_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_adaptive_mt_dataset", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_adaptive_mt_datasets REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse] + # A result object deserialized from the server's reply + def list_adaptive_mt_datasets request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_datasets_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_adaptive_mt_datasets", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the adaptive_mt_translate REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] + # A result object deserialized from the server's reply + def adaptive_mt_translate request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_adaptive_mt_translate_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "adaptive_mt_translate", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # A result object deserialized from the server's reply + def get_adaptive_mt_file request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_adaptive_mt_file_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_adaptive_mt_file", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::AdaptiveMtFile.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_adaptive_mt_file request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_adaptive_mt_file_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_adaptive_mt_file", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] + # A result object deserialized from the server's reply + def import_adaptive_mt_file request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_adaptive_mt_file_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import_adaptive_mt_file", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_adaptive_mt_files REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse] + # A result object deserialized from the server's reply + def list_adaptive_mt_files request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_files_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_adaptive_mt_files", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_adaptive_mt_sentences REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse] + # A result object deserialized from the server's reply + def list_adaptive_mt_sentences request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_sentences_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_adaptive_mt_sentences", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import_data REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ImportDataRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def import_data request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_data_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import_data", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the export_data REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ExportDataRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def export_data request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_export_data_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "export_data", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_examples REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListExamplesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListExamplesResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListExamplesResponse] + # A result object deserialized from the server's reply + def list_examples request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_examples_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_examples", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListExamplesResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the create_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_models REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListModelsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::ListModelsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::ListModelsResponse] + # A result object deserialized from the server's reply + def list_models request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_models", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Translate::V3::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Translate::V3::Model] + # A result object deserialized from the server's reply + def get_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Translate::V3::Model.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the translate_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::TranslateTextRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_translate_text_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:translateText", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:translateText", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the romanize_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::RomanizeTextRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_romanize_text_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:romanizeText", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:romanizeText", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the detect_language REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DetectLanguageRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_detect_language_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:detectLanguage", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:detectLanguage", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_supported_languages REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_supported_languages_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/supportedLanguages", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/supportedLanguages", + matches: [ + ["parent", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the translate_document REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::TranslateDocumentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_translate_document_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:translateDocument", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the batch_translate_text REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateTextRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_batch_translate_text_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:batchTranslateText", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the batch_translate_document REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_batch_translate_document_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:batchTranslateDocument", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_glossary_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}/glossaries", + body: "glossary", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_glossary_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v3/{glossary.name}", + body: "glossary", + matches: [ + ["glossary.name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_glossaries REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListGlossariesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_glossaries_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/glossaries", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_glossary_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_glossary REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_glossary_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_glossary_entry_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_glossary_entries REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_glossary_entries_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/glossaryEntries", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_glossary_entry_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}/glossaryEntries", + body: "glossary_entry", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_glossary_entry_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v3/{glossary_entry.name}", + body: "glossary_entry", + matches: [ + ["glossary_entry.name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_glossary_entry REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_glossary_entry_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}/datasets", + body: "dataset", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_datasets REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListDatasetsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_datasets_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/datasets", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_adaptive_mt_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}/adaptiveMtDatasets", + body: "adaptive_mt_dataset", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_adaptive_mt_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_adaptive_mt_dataset REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_adaptive_mt_dataset_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_adaptive_mt_datasets REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_adaptive_mt_datasets_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/adaptiveMtDatasets", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the adaptive_mt_translate REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_adaptive_mt_translate_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:adaptiveMtTranslate", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_adaptive_mt_file_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_adaptive_mt_file_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import_adaptive_mt_file REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_adaptive_mt_file_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}:importAdaptiveMtFile", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_adaptive_mt_files REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_adaptive_mt_files_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/adaptiveMtFiles", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_adaptive_mt_sentences REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_adaptive_mt_sentences_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/adaptiveMtSentences", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/adaptiveMtSentences", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import_data REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ImportDataRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_data_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{dataset}:importData", + body: "*", + matches: [ + ["dataset", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the export_data REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ExportDataRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_export_data_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{dataset}:exportData", + body: "*", + matches: [ + ["dataset", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_examples REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListExamplesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_examples_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/examples", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the create_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::CreateModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v3/{parent}/models", + body: "model", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_models REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::ListModelsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_models_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{parent}/models", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::GetModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_model REST call + # + # @param request_pb [::Google::Cloud::Translate::V3::DeleteModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v3/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb new file mode 100644 index 000000000000..23109d6811b2 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/translate/v3/translation_service.proto + +require 'google/protobuf' + +require 'google/cloud/translate/v3/adaptive_mt_pb' +require 'google/cloud/translate/v3/automl_translation_pb' +require 'google/cloud/translate/v3/common_pb' +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/longrunning/operations_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n3google/cloud/translate/v3/translation_service.proto\x12\x1bgoogle.cloud.translation.v3\x1a+google/cloud/translate/v3/adaptive_mt.proto\x1a\x32google/cloud/translate/v3/automl_translation.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"7\n\x15TransliterationConfig\x12\x1e\n\x16\x65nable_transliteration\x18\x01 \x01(\x08\"\x8e\x04\n\x14TranslateTextRequest\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x06parent\x18\x08 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12W\n\x16transliteration_config\x18\r \x01(\x0b\x32\x32.google.cloud.translation.v3.TransliterationConfigB\x03\xe0\x41\x01\x12R\n\x06labels\x18\n \x03(\x0b\x32=.google.cloud.translation.v3.TranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xa0\x01\n\x15TranslateTextResponse\x12>\n\x0ctranslations\x18\x01 \x03(\x0b\x32(.google.cloud.translation.v3.Translation\x12G\n\x15glossary_translations\x18\x03 \x03(\x0b\x32(.google.cloud.translation.v3.Translation\"\xa8\x01\n\x0bTranslation\x12\x17\n\x0ftranslated_text\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x04 \x01(\t\x12Q\n\x0fglossary_config\x18\x03 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig\"\x8a\x01\n\x13RomanizeTextRequest\x12\x39\n\x06parent\x18\x04 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\"F\n\x0cRomanization\x12\x16\n\x0eromanized_text\x18\x01 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x02 \x01(\t\"X\n\x14RomanizeTextResponse\x12@\n\rromanizations\x18\x01 \x03(\x0b\x32).google.cloud.translation.v3.Romanization\"\x9f\x02\n\x15\x44\x65tectLanguageRequest\x12\x39\n\x06parent\x18\x05 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x11\n\x07\x63ontent\x18\x01 \x01(\tH\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12S\n\x06labels\x18\x06 \x03(\x0b\x32>.google.cloud.translation.v3.DetectLanguageRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06source\"=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\"Z\n\x16\x44\x65tectLanguageResponse\x12@\n\tlanguages\x18\x01 \x03(\x0b\x32-.google.cloud.translation.v3.DetectedLanguage\"\x91\x01\n\x1cGetSupportedLanguagesRequest\x12\x39\n\x06parent\x18\x03 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\"\n\x15\x64isplay_language_code\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x02 \x01(\tB\x03\xe0\x41\x01\"W\n\x12SupportedLanguages\x12\x41\n\tlanguages\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.SupportedLanguage\"p\n\x11SupportedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x16\n\x0esupport_source\x18\x03 \x01(\x08\x12\x16\n\x0esupport_target\x18\x04 \x01(\x08\"#\n\tGcsSource\x12\x16\n\tinput_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\"m\n\x0bInputConfig\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"0\n\x0eGcsDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\"e\n\x0cOutputConfig\x12\x46\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\x83\x01\n\x13\x44ocumentInputConfig\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x12\x11\n\tmime_type\x18\x04 \x01(\tB\x08\n\x06source\"\x8a\x01\n\x14\x44ocumentOutputConfig\x12K\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationB\x03\xe0\x41\x01H\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x42\r\n\x0b\x64\x65stination\"\xbe\x05\n\x18TranslateDocumentRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12T\n\x15\x64ocument_input_config\x18\x04 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentInputConfigB\x03\xe0\x41\x02\x12V\n\x16\x64ocument_output_config\x18\x05 \x01(\x0b\x32\x31.google.cloud.translation.v3.DocumentOutputConfigB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12V\n\x06labels\x18\x08 \x03(\x0b\x32\x41.google.cloud.translation.v3.TranslateDocumentRequest.LabelsEntryB\x03\xe0\x41\x01\x12#\n\x16\x63ustomized_attribution\x18\n \x01(\tB\x03\xe0\x41\x01\x12)\n\x1cis_translate_native_pdf_only\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01\x12-\n enable_shadow_removal_native_pdf\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65nable_rotation_correction\x18\r \x01(\x08\x42\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"e\n\x13\x44ocumentTranslation\x12\x1b\n\x13\x62yte_stream_outputs\x18\x01 \x03(\x0c\x12\x11\n\tmime_type\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x03 \x01(\t\"\xa6\x02\n\x19TranslateDocumentResponse\x12N\n\x14\x64ocument_translation\x18\x01 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentTranslation\x12W\n\x1dglossary_document_translation\x18\x02 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentTranslation\x12\r\n\x05model\x18\x03 \x01(\t\x12Q\n\x0fglossary_config\x18\x04 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig\"\x88\x06\n\x19\x42\x61tchTranslateTextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12W\n\x06models\x18\x04 \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntryB\x03\xe0\x41\x01\x12\x44\n\rinput_configs\x18\x05 \x03(\x0b\x32(.google.cloud.translation.v3.InputConfigB\x03\xe0\x41\x02\x12\x45\n\routput_config\x18\x06 \x01(\x0b\x32).google.cloud.translation.v3.OutputConfigB\x03\xe0\x41\x02\x12_\n\nglossaries\x18\x07 \x03(\x0b\x32\x46.google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntryB\x03\xe0\x41\x01\x12W\n\x06labels\x18\t \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ak\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xce\x02\n\x16\x42\x61tchTranslateMetadata\x12H\n\x05state\x18\x01 \x01(\x0e\x32\x39.google.cloud.translation.v3.BatchTranslateMetadata.State\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12\x18\n\x10total_characters\x18\x04 \x01(\x03\x12/\n\x0bsubmit_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xcb\x01\n\x16\x42\x61tchTranslateResponse\x12\x18\n\x10total_characters\x18\x01 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12/\n\x0bsubmit_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"]\n\x13GlossaryInputConfig\x12<\n\ngcs_source\x18\x01 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"\x9a\x05\n\x08Glossary\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12O\n\rlanguage_pair\x18\x03 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodePairH\x00\x12T\n\x12language_codes_set\x18\x04 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodesSetH\x00\x12\x46\n\x0cinput_config\x18\x05 \x01(\x0b\x32\x30.google.cloud.translation.v3.GlossaryInputConfig\x12\x18\n\x0b\x65ntry_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0bsubmit_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x19\n\x0c\x64isplay_name\x18\t \x01(\tB\x03\xe0\x41\x01\x1aN\n\x10LanguageCodePair\x12\x1c\n\x14source_language_code\x18\x01 \x01(\t\x12\x1c\n\x14target_language_code\x18\x02 \x01(\t\x1a*\n\x10LanguageCodesSet\x12\x16\n\x0elanguage_codes\x18\x01 \x03(\t:e\xea\x41\x62\n!translate.googleapis.com/Glossary\x12=projects/{project}/locations/{location}/glossaries/{glossary}B\x0b\n\tlanguages\"\x90\x01\n\x15\x43reateGlossaryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12<\n\x08glossary\x18\x02 \x01(\x0b\x32%.google.cloud.translation.v3.GlossaryB\x03\xe0\x41\x02\"\x86\x01\n\x15UpdateGlossaryRequest\x12<\n\x08glossary\x18\x01 \x01(\x0b\x32%.google.cloud.translation.v3.GlossaryB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"M\n\x12GetGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\"P\n\x15\x44\x65leteGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\"\x98\x01\n\x15ListGlossariesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"l\n\x16ListGlossariesResponse\x12\x39\n\nglossaries\x18\x01 \x03(\x0b\x32%.google.cloud.translation.v3.Glossary\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"W\n\x17GetGlossaryEntryRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&translate.googleapis.com/GlossaryEntry\"Z\n\x1a\x44\x65leteGlossaryEntryRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&translate.googleapis.com/GlossaryEntry\"\x88\x01\n\x1aListGlossaryEntriesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x86\x01\n\x1bListGlossaryEntriesResponse\x12I\n\x10glossary_entries\x18\x01 \x03(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x01\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\xa0\x01\n\x1a\x43reateGlossaryEntryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12G\n\x0eglossary_entry\x18\x02 \x01(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x02\"e\n\x1aUpdateGlossaryEntryRequest\x12G\n\x0eglossary_entry\x18\x01 \x01(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x02\"\x88\x02\n\x16\x43reateGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.CreateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xb3\x02\n\x16UpdateGlossaryMetadata\x12\x37\n\x08glossary\x18\x01 \x01(\x0b\x32%.google.cloud.translation.v3.Glossary\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.UpdateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\x88\x02\n\x16\x44\x65leteGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.DeleteGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\x85\x01\n\x16\x44\x65leteGlossaryResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0bsubmit_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xd1\x07\n\x1d\x42\x61tchTranslateDocumentRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12Q\n\rinput_configs\x18\x04 \x03(\x0b\x32\x35.google.cloud.translation.v3.BatchDocumentInputConfigB\x03\xe0\x41\x02\x12R\n\routput_config\x18\x05 \x01(\x0b\x32\x36.google.cloud.translation.v3.BatchDocumentOutputConfigB\x03\xe0\x41\x02\x12[\n\x06models\x18\x06 \x03(\x0b\x32\x46.google.cloud.translation.v3.BatchTranslateDocumentRequest.ModelsEntryB\x03\xe0\x41\x01\x12\x63\n\nglossaries\x18\x07 \x03(\x0b\x32J.google.cloud.translation.v3.BatchTranslateDocumentRequest.GlossariesEntryB\x03\xe0\x41\x01\x12r\n\x12\x66ormat_conversions\x18\x08 \x03(\x0b\x32Q.google.cloud.translation.v3.BatchTranslateDocumentRequest.FormatConversionsEntryB\x03\xe0\x41\x01\x12#\n\x16\x63ustomized_attribution\x18\n \x01(\tB\x03\xe0\x41\x01\x12-\n enable_shadow_removal_native_pdf\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65nable_rotation_correction\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ak\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig:\x02\x38\x01\x1a\x38\n\x16\x46ormatConversionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"b\n\x18\x42\x61tchDocumentInputConfig\x12<\n\ngcs_source\x18\x01 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"r\n\x19\x42\x61tchDocumentOutputConfig\x12\x46\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\xd9\x02\n\x1e\x42\x61tchTranslateDocumentResponse\x12\x13\n\x0btotal_pages\x18\x01 \x01(\x03\x12\x18\n\x10translated_pages\x18\x02 \x01(\x03\x12\x14\n\x0c\x66\x61iled_pages\x18\x03 \x01(\x03\x12\x1c\n\x14total_billable_pages\x18\x04 \x01(\x03\x12\x18\n\x10total_characters\x18\x05 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x06 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x07 \x01(\x03\x12!\n\x19total_billable_characters\x18\x08 \x01(\x03\x12/\n\x0bsubmit_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xe4\x03\n\x1e\x42\x61tchTranslateDocumentMetadata\x12P\n\x05state\x18\x01 \x01(\x0e\x32\x41.google.cloud.translation.v3.BatchTranslateDocumentMetadata.State\x12\x13\n\x0btotal_pages\x18\x02 \x01(\x03\x12\x18\n\x10translated_pages\x18\x03 \x01(\x03\x12\x14\n\x0c\x66\x61iled_pages\x18\x04 \x01(\x03\x12\x1c\n\x14total_billable_pages\x18\x05 \x01(\x03\x12\x18\n\x10total_characters\x18\x06 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x07 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x08 \x01(\x03\x12!\n\x19total_billable_characters\x18\t \x01(\x03\x12/\n\x0bsubmit_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xa1\x01\n\x1bTranslateTextGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x32\xbd\x43\n\x12TranslationService\x12\xd4\x02\n\rTranslateText\x12\x31.google.cloud.translation.v3.TranslateTextRequest\x1a\x32.google.cloud.translation.v3.TranslateTextResponse\"\xdb\x01\xda\x41$parent,target_language_code,contents\xda\x41Iparent,model,mime_type,source_language_code,target_language_code,contents\x82\xd3\xe4\x93\x02\x62\"1/v3/{parent=projects/*/locations/*}:translateText:\x01*Z*\"%/v3/{parent=projects/*}:translateText:\x01*\x12\xed\x01\n\x0cRomanizeText\x12\x30.google.cloud.translation.v3.RomanizeTextRequest\x1a\x31.google.cloud.translation.v3.RomanizeTextResponse\"x\xda\x41\x0fparent,contents\x82\xd3\xe4\x93\x02`\"0/v3/{parent=projects/*/locations/*}:romanizeText:\x01*Z)\"$/v3/{parent=projects/*}:romanizeText:\x01*\x12\x87\x02\n\x0e\x44\x65tectLanguage\x12\x32.google.cloud.translation.v3.DetectLanguageRequest\x1a\x33.google.cloud.translation.v3.DetectLanguageResponse\"\x8b\x01\xda\x41\x1eparent,model,mime_type,content\x82\xd3\xe4\x93\x02\x64\"2/v3/{parent=projects/*/locations/*}:detectLanguage:\x01*Z+\"&/v3/{parent=projects/*}:detectLanguage:\x01*\x12\x97\x02\n\x15GetSupportedLanguages\x12\x39.google.cloud.translation.v3.GetSupportedLanguagesRequest\x1a/.google.cloud.translation.v3.SupportedLanguages\"\x91\x01\xda\x41\"parent,model,display_language_code\x82\xd3\xe4\x93\x02\x66\x12\x36/v3/{parent=projects/*/locations/*}/supportedLanguagesZ,\x12*/v3/{parent=projects/*}/supportedLanguages\x12\xc4\x01\n\x11TranslateDocument\x12\x35.google.cloud.translation.v3.TranslateDocumentRequest\x1a\x36.google.cloud.translation.v3.TranslateDocumentResponse\"@\x82\xd3\xe4\x93\x02:\"5/v3/{parent=projects/*/locations/*}:translateDocument:\x01*\x12\xe1\x01\n\x12\x42\x61tchTranslateText\x12\x36.google.cloud.translation.v3.BatchTranslateTextRequest\x1a\x1d.google.longrunning.Operation\"t\xca\x41\x30\n\x16\x42\x61tchTranslateResponse\x12\x16\x42\x61tchTranslateMetadata\x82\xd3\xe4\x93\x02;\"6/v3/{parent=projects/*/locations/*}:batchTranslateText:\x01*\x12\xce\x02\n\x16\x42\x61tchTranslateDocument\x12:.google.cloud.translation.v3.BatchTranslateDocumentRequest\x1a\x1d.google.longrunning.Operation\"\xd8\x01\xca\x41@\n\x1e\x42\x61tchTranslateDocumentResponse\x12\x1e\x42\x61tchTranslateDocumentMetadata\xda\x41Mparent,source_language_code,target_language_codes,input_configs,output_config\x82\xd3\xe4\x93\x02?\":/v3/{parent=projects/*/locations/*}:batchTranslateDocument:\x01*\x12\xdc\x01\n\x0e\x43reateGlossary\x12\x32.google.cloud.translation.v3.CreateGlossaryRequest\x1a\x1d.google.longrunning.Operation\"w\xca\x41\"\n\x08Glossary\x12\x16\x43reateGlossaryMetadata\xda\x41\x0fparent,glossary\x82\xd3\xe4\x93\x02:\"./v3/{parent=projects/*/locations/*}/glossaries:\x08glossary\x12\xeb\x01\n\x0eUpdateGlossary\x12\x32.google.cloud.translation.v3.UpdateGlossaryRequest\x1a\x1d.google.longrunning.Operation\"\x85\x01\xca\x41\"\n\x08Glossary\x12\x16UpdateGlossaryMetadata\xda\x41\x14glossary,update_mask\x82\xd3\xe4\x93\x02\x43\x32\x37/v3/{glossary.name=projects/*/locations/*/glossaries/*}:\x08glossary\x12\xba\x01\n\x0eListGlossaries\x12\x32.google.cloud.translation.v3.ListGlossariesRequest\x1a\x33.google.cloud.translation.v3.ListGlossariesResponse\"?\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x30\x12./v3/{parent=projects/*/locations/*}/glossaries\x12\xa4\x01\n\x0bGetGlossary\x12/.google.cloud.translation.v3.GetGlossaryRequest\x1a%.google.cloud.translation.v3.Glossary\"=\xda\x41\x04name\x82\xd3\xe4\x93\x02\x30\x12./v3/{name=projects/*/locations/*/glossaries/*}\x12\xd5\x01\n\x0e\x44\x65leteGlossary\x12\x32.google.cloud.translation.v3.DeleteGlossaryRequest\x1a\x1d.google.longrunning.Operation\"p\xca\x41\x30\n\x16\x44\x65leteGlossaryResponse\x12\x16\x44\x65leteGlossaryMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02\x30*./v3/{name=projects/*/locations/*/glossaries/*}\x12\xc5\x01\n\x10GetGlossaryEntry\x12\x34.google.cloud.translation.v3.GetGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"O\xda\x41\x04name\x82\xd3\xe4\x93\x02\x42\x12@/v3/{name=projects/*/locations/*/glossaries/*/glossaryEntries/*}\x12\xdb\x01\n\x13ListGlossaryEntries\x12\x37.google.cloud.translation.v3.ListGlossaryEntriesRequest\x1a\x38.google.cloud.translation.v3.ListGlossaryEntriesResponse\"Q\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x42\x12@/v3/{parent=projects/*/locations/*/glossaries/*}/glossaryEntries\x12\xec\x01\n\x13\x43reateGlossaryEntry\x12\x37.google.cloud.translation.v3.CreateGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"p\xda\x41\x15parent,glossary_entry\x82\xd3\xe4\x93\x02R\"@/v3/{parent=projects/*/locations/*/glossaries/*}/glossaryEntries:\x0eglossary_entry\x12\xf4\x01\n\x13UpdateGlossaryEntry\x12\x37.google.cloud.translation.v3.UpdateGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"x\xda\x41\x0eglossary_entry\x82\xd3\xe4\x93\x02\x61\x32O/v3/{glossary_entry.name=projects/*/locations/*/glossaries/*/glossaryEntries/*}:\x0eglossary_entry\x12\xb7\x01\n\x13\x44\x65leteGlossaryEntry\x12\x37.google.cloud.translation.v3.DeleteGlossaryEntryRequest\x1a\x16.google.protobuf.Empty\"O\xda\x41\x04name\x82\xd3\xe4\x93\x02\x42*@/v3/{name=projects/*/locations/*/glossaries/*/glossaryEntries/*}\x12\xd4\x01\n\rCreateDataset\x12\x31.google.cloud.translation.v3.CreateDatasetRequest\x1a\x1d.google.longrunning.Operation\"q\xca\x41 \n\x07\x44\x61taset\x12\x15\x43reateDatasetMetadata\xda\x41\x0eparent,dataset\x82\xd3\xe4\x93\x02\x37\",/v3/{parent=projects/*/locations/*}/datasets:\x07\x64\x61taset\x12\x9f\x01\n\nGetDataset\x12..google.cloud.translation.v3.GetDatasetRequest\x1a$.google.cloud.translation.v3.Dataset\";\xda\x41\x04name\x82\xd3\xe4\x93\x02.\x12,/v3/{name=projects/*/locations/*/datasets/*}\x12\xb2\x01\n\x0cListDatasets\x12\x30.google.cloud.translation.v3.ListDatasetsRequest\x1a\x31.google.cloud.translation.v3.ListDatasetsResponse\"=\xda\x41\x06parent\x82\xd3\xe4\x93\x02.\x12,/v3/{parent=projects/*/locations/*}/datasets\x12\xcf\x01\n\rDeleteDataset\x12\x31.google.cloud.translation.v3.DeleteDatasetRequest\x1a\x1d.google.longrunning.Operation\"l\xca\x41.\n\x15google.protobuf.Empty\x12\x15\x44\x65leteDatasetMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02.*,/v3/{name=projects/*/locations/*/datasets/*}\x12\xf8\x01\n\x17\x43reateAdaptiveMtDataset\x12;.google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest\x1a..google.cloud.translation.v3.AdaptiveMtDataset\"p\xda\x41\x1aparent,adaptive_mt_dataset\x82\xd3\xe4\x93\x02M\"6/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets:\x13\x61\x64\x61ptive_mt_dataset\x12\xb5\x01\n\x17\x44\x65leteAdaptiveMtDataset\x12;.google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest\x1a\x16.google.protobuf.Empty\"E\xda\x41\x04name\x82\xd3\xe4\x93\x02\x38*6/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}\x12\xc7\x01\n\x14GetAdaptiveMtDataset\x12\x38.google.cloud.translation.v3.GetAdaptiveMtDatasetRequest\x1a..google.cloud.translation.v3.AdaptiveMtDataset\"E\xda\x41\x04name\x82\xd3\xe4\x93\x02\x38\x12\x36/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}\x12\xda\x01\n\x16ListAdaptiveMtDatasets\x12:.google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest\x1a;.google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse\"G\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x38\x12\x36/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets\x12\xdd\x01\n\x13\x41\x64\x61ptiveMtTranslate\x12\x37.google.cloud.translation.v3.AdaptiveMtTranslateRequest\x1a\x38.google.cloud.translation.v3.AdaptiveMtTranslateResponse\"S\xda\x41\x0eparent,content\x82\xd3\xe4\x93\x02<\"7/v3/{parent=projects/*/locations/*}:adaptiveMtTranslate:\x01*\x12\xd0\x01\n\x11GetAdaptiveMtFile\x12\x35.google.cloud.translation.v3.GetAdaptiveMtFileRequest\x1a+.google.cloud.translation.v3.AdaptiveMtFile\"W\xda\x41\x04name\x82\xd3\xe4\x93\x02J\x12H/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}\x12\xc1\x01\n\x14\x44\x65leteAdaptiveMtFile\x12\x38.google.cloud.translation.v3.DeleteAdaptiveMtFileRequest\x1a\x16.google.protobuf.Empty\"W\xda\x41\x04name\x82\xd3\xe4\x93\x02J*H/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}\x12\xee\x01\n\x14ImportAdaptiveMtFile\x12\x38.google.cloud.translation.v3.ImportAdaptiveMtFileRequest\x1a\x39.google.cloud.translation.v3.ImportAdaptiveMtFileResponse\"a\xda\x41\x06parent\x82\xd3\xe4\x93\x02R\"M/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}:importAdaptiveMtFile:\x01*\x12\xe3\x01\n\x13ListAdaptiveMtFiles\x12\x37.google.cloud.translation.v3.ListAdaptiveMtFilesRequest\x1a\x38.google.cloud.translation.v3.ListAdaptiveMtFilesResponse\"Y\xda\x41\x06parent\x82\xd3\xe4\x93\x02J\x12H/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtFiles\x12\xd7\x02\n\x17ListAdaptiveMtSentences\x12;.google.cloud.translation.v3.ListAdaptiveMtSentencesRequest\x1a<.google.cloud.translation.v3.ListAdaptiveMtSentencesResponse\"\xc0\x01\xda\x41\x06parent\x82\xd3\xe4\x93\x02\xb0\x01\x12^/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}/adaptiveMtSentencesZN\x12L/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtSentences\x12\xe8\x01\n\nImportData\x12..google.cloud.translation.v3.ImportDataRequest\x1a\x1d.google.longrunning.Operation\"\x8a\x01\xca\x41+\n\x15google.protobuf.Empty\x12\x12ImportDataMetadata\xda\x41\x14\x64\x61taset,input_config\x82\xd3\xe4\x93\x02?\":/v3/{dataset=projects/*/locations/*/datasets/*}:importData:\x01*\x12\xe9\x01\n\nExportData\x12..google.cloud.translation.v3.ExportDataRequest\x1a\x1d.google.longrunning.Operation\"\x8b\x01\xca\x41+\n\x15google.protobuf.Empty\x12\x12\x45xportDataMetadata\xda\x41\x15\x64\x61taset,output_config\x82\xd3\xe4\x93\x02?\":/v3/{dataset=projects/*/locations/*/datasets/*}:exportData:\x01*\x12\xbd\x01\n\x0cListExamples\x12\x30.google.cloud.translation.v3.ListExamplesRequest\x1a\x31.google.cloud.translation.v3.ListExamplesResponse\"H\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x39\x12\x37/v3/{parent=projects/*/locations/*/datasets/*}/examples\x12\xc6\x01\n\x0b\x43reateModel\x12/.google.cloud.translation.v3.CreateModelRequest\x1a\x1d.google.longrunning.Operation\"g\xca\x41\x1c\n\x05Model\x12\x13\x43reateModelMetadata\xda\x41\x0cparent,model\x82\xd3\xe4\x93\x02\x33\"*/v3/{parent=projects/*/locations/*}/models:\x05model\x12\xaa\x01\n\nListModels\x12..google.cloud.translation.v3.ListModelsRequest\x1a/.google.cloud.translation.v3.ListModelsResponse\";\xda\x41\x06parent\x82\xd3\xe4\x93\x02,\x12*/v3/{parent=projects/*/locations/*}/models\x12\x97\x01\n\x08GetModel\x12,.google.cloud.translation.v3.GetModelRequest\x1a\".google.cloud.translation.v3.Model\"9\xda\x41\x04name\x82\xd3\xe4\x93\x02,\x12*/v3/{name=projects/*/locations/*/models/*}\x12\xc7\x01\n\x0b\x44\x65leteModel\x12/.google.cloud.translation.v3.DeleteModelRequest\x1a\x1d.google.longrunning.Operation\"h\xca\x41,\n\x15google.protobuf.Empty\x12\x13\x44\x65leteModelMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02,**/v3/{name=projects/*/locations/*/models/*}\x1a~\xca\x41\x18translate.googleapis.com\xd2\x41`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translationB\xd6\x01\n\x1d\x63om.google.cloud.translate.v3B\x17TranslationServiceProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xa2\x02\x05\x43TRL3\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3P\x00P\x01P\x02\x62\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Translate + module V3 + TransliterationConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TransliterationConfig").msgclass + TranslateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextRequest").msgclass + TranslateTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextResponse").msgclass + Translation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Translation").msgclass + RomanizeTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.RomanizeTextRequest").msgclass + Romanization = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Romanization").msgclass + RomanizeTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.RomanizeTextResponse").msgclass + DetectLanguageRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectLanguageRequest").msgclass + DetectedLanguage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectedLanguage").msgclass + DetectLanguageResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectLanguageResponse").msgclass + GetSupportedLanguagesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetSupportedLanguagesRequest").msgclass + SupportedLanguages = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.SupportedLanguages").msgclass + SupportedLanguage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.SupportedLanguage").msgclass + GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsSource").msgclass + InputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.InputConfig").msgclass + GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsDestination").msgclass + OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.OutputConfig").msgclass + DocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentInputConfig").msgclass + DocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentOutputConfig").msgclass + TranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentRequest").msgclass + DocumentTranslation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentTranslation").msgclass + TranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentResponse").msgclass + BatchTranslateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateTextRequest").msgclass + BatchTranslateMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata").msgclass + BatchTranslateMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata.State").enummodule + BatchTranslateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateResponse").msgclass + GlossaryInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryInputConfig").msgclass + Glossary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary").msgclass + Glossary::LanguageCodePair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary.LanguageCodePair").msgclass + Glossary::LanguageCodesSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary.LanguageCodesSet").msgclass + CreateGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryRequest").msgclass + UpdateGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryRequest").msgclass + GetGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetGlossaryRequest").msgclass + DeleteGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryRequest").msgclass + ListGlossariesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossariesRequest").msgclass + ListGlossariesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossariesResponse").msgclass + GetGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetGlossaryEntryRequest").msgclass + DeleteGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryEntryRequest").msgclass + ListGlossaryEntriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossaryEntriesRequest").msgclass + ListGlossaryEntriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossaryEntriesResponse").msgclass + CreateGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryEntryRequest").msgclass + UpdateGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryEntryRequest").msgclass + CreateGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryMetadata").msgclass + CreateGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryMetadata.State").enummodule + UpdateGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryMetadata").msgclass + UpdateGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryMetadata.State").enummodule + DeleteGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata").msgclass + DeleteGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata.State").enummodule + DeleteGlossaryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryResponse").msgclass + BatchTranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentRequest").msgclass + BatchDocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentInputConfig").msgclass + BatchDocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentOutputConfig").msgclass + BatchTranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentResponse").msgclass + BatchTranslateDocumentMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata").msgclass + BatchTranslateDocumentMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata.State").enummodule + TranslateTextGlossaryConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextGlossaryConfig").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb new file mode 100644 index 000000000000..d7dd9d8ae961 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb @@ -0,0 +1,141 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/translate/v3/translation_service.proto for package 'Google.Cloud.Translate.V3' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. +# + +require 'grpc' +require 'google/cloud/translate/v3/translation_service_pb' + +module Google + module Cloud + module Translate + module V3 + module TranslationService + # Proto file for the Cloud Translation API (v3 GA). + # + # Provides natural language translation operations. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.translation.v3.TranslationService' + + # Translates input text and returns translated text. + rpc :TranslateText, ::Google::Cloud::Translate::V3::TranslateTextRequest, ::Google::Cloud::Translate::V3::TranslateTextResponse + # Romanize input text written in non-Latin scripts to Latin text. + rpc :RomanizeText, ::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Google::Cloud::Translate::V3::RomanizeTextResponse + # Detects the language of text within a request. + rpc :DetectLanguage, ::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Google::Cloud::Translate::V3::DetectLanguageResponse + # Returns a list of supported languages for translation. + rpc :GetSupportedLanguages, ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Google::Cloud::Translate::V3::SupportedLanguages + # Translates documents in synchronous mode. + rpc :TranslateDocument, ::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Google::Cloud::Translate::V3::TranslateDocumentResponse + # 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 + # 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 :BatchTranslateText, ::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Google::Longrunning::Operation + # 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, ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Google::Longrunning::Operation + # Creates a glossary and returns the long-running operation. Returns + # NOT_FOUND, if the project doesn't exist. + rpc :CreateGlossary, ::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Google::Longrunning::Operation + # Updates a glossary. A LRO is used since the update can be async if the + # glossary's entry file is updated. + rpc :UpdateGlossary, ::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Google::Longrunning::Operation + # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + # exist. + rpc :ListGlossaries, ::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Google::Cloud::Translate::V3::ListGlossariesResponse + # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + # exist. + rpc :GetGlossary, ::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Google::Cloud::Translate::V3::Glossary + # Deletes a glossary, or cancels glossary construction + # if the glossary isn't created yet. + # Returns NOT_FOUND, if the glossary doesn't exist. + rpc :DeleteGlossary, ::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Google::Longrunning::Operation + # Gets a single glossary entry by the given id. + rpc :GetGlossaryEntry, ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry + # List the entries for the glossary. + rpc :ListGlossaryEntries, ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse + # Creates a glossary entry. + rpc :CreateGlossaryEntry, ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry + # Updates a glossary entry. + rpc :UpdateGlossaryEntry, ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry + # Deletes a single entry from the glossary + rpc :DeleteGlossaryEntry, ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Google::Protobuf::Empty + # Creates a Dataset. + rpc :CreateDataset, ::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Google::Longrunning::Operation + # Gets a Dataset. + rpc :GetDataset, ::Google::Cloud::Translate::V3::GetDatasetRequest, ::Google::Cloud::Translate::V3::Dataset + # Lists datasets. + rpc :ListDatasets, ::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Google::Cloud::Translate::V3::ListDatasetsResponse + # Deletes a dataset and all of its contents. + rpc :DeleteDataset, ::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Google::Longrunning::Operation + # Creates an Adaptive MT dataset. + rpc :CreateAdaptiveMtDataset, ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Google::Cloud::Translate::V3::AdaptiveMtDataset + # Deletes an Adaptive MT dataset, including all its entries and associated + # metadata. + rpc :DeleteAdaptiveMtDataset, ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Google::Protobuf::Empty + # Gets the Adaptive MT dataset. + rpc :GetAdaptiveMtDataset, ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Google::Cloud::Translate::V3::AdaptiveMtDataset + # Lists all Adaptive MT datasets for which the caller has read permission. + rpc :ListAdaptiveMtDatasets, ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse + # Translate text using Adaptive MT. + rpc :AdaptiveMtTranslate, ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse + # Gets and AdaptiveMtFile + rpc :GetAdaptiveMtFile, ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Google::Cloud::Translate::V3::AdaptiveMtFile + # Deletes an AdaptiveMtFile along with its sentences. + rpc :DeleteAdaptiveMtFile, ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Google::Protobuf::Empty + # Imports an AdaptiveMtFile and adds all of its sentences into the + # AdaptiveMtDataset. + rpc :ImportAdaptiveMtFile, ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse + # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. + rpc :ListAdaptiveMtFiles, ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse + # Lists all AdaptiveMtSentences under a given file/dataset. + rpc :ListAdaptiveMtSentences, ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse + # Import sentence pairs into translation Dataset. + rpc :ImportData, ::Google::Cloud::Translate::V3::ImportDataRequest, ::Google::Longrunning::Operation + # Exports dataset's data to the provided output location. + rpc :ExportData, ::Google::Cloud::Translate::V3::ExportDataRequest, ::Google::Longrunning::Operation + # Lists sentence pairs in the dataset. + rpc :ListExamples, ::Google::Cloud::Translate::V3::ListExamplesRequest, ::Google::Cloud::Translate::V3::ListExamplesResponse + # Creates a Model. + rpc :CreateModel, ::Google::Cloud::Translate::V3::CreateModelRequest, ::Google::Longrunning::Operation + # Lists models. + rpc :ListModels, ::Google::Cloud::Translate::V3::ListModelsRequest, ::Google::Cloud::Translate::V3::ListModelsResponse + # Gets a model. + rpc :GetModel, ::Google::Cloud::Translate::V3::GetModelRequest, ::Google::Cloud::Translate::V3::Model + # Deletes a model. + rpc :DeleteModel, ::Google::Cloud::Translate::V3::DeleteModelRequest, ::Google::Longrunning::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb new file mode 100644 index 000000000000..dacb619abd34 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + VERSION = "0.0.1" + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md b/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md new file mode 100644 index 000000000000..4a5eb6a2d169 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md @@ -0,0 +1,4 @@ +# Cloud Translation V3 Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..3ab0b096d445 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb @@ -0,0 +1,593 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # The destination where API teams want this client library to be published. + # @!attribute [rw] selective_gapic_generation + # @return [::Google::Api::SelectiveGapicGeneration] + # Configuration for which RPCs should be generated in the GAPIC client. + # + # Note: This field should not be used in most cases. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Php. Clobbers the php_namespace option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.php.package_name" field + # in gapic.yaml. API teams should use the protobuf php_namespace option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # php_settings: + # library_package: Google\Cloud\PubSub\V1 + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] experimental_features + # @return [::Google::Api::PythonSettings::ExperimentalFeatures] + # Experimental features to be included during client library generation. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Experimental features to be included during client library generation. + # These fields will be deprecated once the feature graduates and is enabled + # by default. + # @!attribute [rw] rest_async_io_enabled + # @return [::Boolean] + # Enables generation of asynchronous REST clients if `rest` transport is + # enabled. By default, asynchronous REST clients will not be generated. + # This feature will be enabled by default 1 month after launching the + # feature in preview packages. + # @!attribute [rw] protobuf_pythonic_types_enabled + # @return [::Boolean] + # Enables generation of protobuf code using new types that are more + # Pythonic which are included in `protobuf>=5.29.x`. This feature will be + # enabled by default 1 month after launching the feature in preview + # packages. + # @!attribute [rw] unversioned_package_disabled + # @return [::Boolean] + # Disables generation of an unversioned Python package for this client + # library. This means that the module names will need to be versioned in + # import statements. For example `import google.cloud.library_v2` instead + # of `import google.cloud.library`. + class ExperimentalFeatures + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map of service names to renamed services. Keys are the package relative + # service names and values are the name to be used for the service client + # and call options. + # + # Example: + # + # publishing: + # go_settings: + # renamed_services: + # Publisher: TopicAdmin + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # + # Example: + # + # publishing: + # method_settings: + # - selector: google.storage.control.v2.StorageControl.CreateFolder + # # method settings for CreateFolder... + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: 60s # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: 360s # 6 minutes + # total_poll_timeout: 54000s # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + # @!attribute [rw] batching + # @return [::Google::Api::BatchingConfigProto] + # Batching configuration for an API method in client libraries. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.BatchCreateExample + # batching: + # element_count_threshold: 1000 + # request_byte_threshold: 100000000 + # delay_threshold_millis: 10 + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This message is used to configure the generation of a subset of the RPCs in + # a service for client libraries. + # + # Note: This feature should not be used in most cases. + # @!attribute [rw] methods + # @return [::Array<::String>] + # An allowlist of the fully qualified names of RPCs that should be included + # on public client surfaces. + # @!attribute [rw] generate_omitted_as_internal + # @return [::Boolean] + # Setting this to true indicates to the client generators that methods + # that would be excluded from the generation should instead be generated + # in a way that indicates these methods should not be consumed by + # end users. How this is expressed is up to individual language + # implementations to decide. Some examples may be: added annotations, + # obfuscated identifiers, or other language idiomatic patterns. + class SelectiveGapicGeneration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingConfigProto` defines the batching configuration for an API method. + # @!attribute [rw] thresholds + # @return [::Google::Api::BatchingSettingsProto] + # The thresholds which trigger a batched request to be sent. + # @!attribute [rw] batch_descriptor + # @return [::Google::Api::BatchingDescriptorProto] + # The request and response fields used in batching. + class BatchingConfigProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingSettingsProto` specifies a set of batching thresholds, each of + # which acts as a trigger to send a batch of messages as a request. At least + # one threshold must be positive nonzero. + # @!attribute [rw] element_count_threshold + # @return [::Integer] + # The number of elements of a field collected into a batch which, if + # exceeded, causes the batch to be sent. + # @!attribute [rw] request_byte_threshold + # @return [::Integer] + # The aggregated size of the batched field which, if exceeded, causes the + # batch to be sent. This size is computed by aggregating the sizes of the + # request field to be batched, not of the entire request message. + # @!attribute [rw] delay_threshold + # @return [::Google::Protobuf::Duration] + # The duration after which a batch should be sent, starting from the addition + # of the first message to that batch. + # @!attribute [rw] element_count_limit + # @return [::Integer] + # The maximum number of elements collected in a batch that could be accepted + # by server. + # @!attribute [rw] request_byte_limit + # @return [::Integer] + # The maximum size of the request that could be accepted by server. + # @!attribute [rw] flow_control_element_limit + # @return [::Integer] + # The maximum number of elements allowed by flow control. + # @!attribute [rw] flow_control_byte_limit + # @return [::Integer] + # The maximum size of data allowed by flow control. + # @!attribute [rw] flow_control_limit_exceeded_behavior + # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] + # The behavior to take when the flow control limit is exceeded. + class BatchingSettingsProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingDescriptorProto` specifies the fields of the request message to be + # used for batching, and, optionally, the fields of the response message to be + # used for demultiplexing. + # @!attribute [rw] batched_field + # @return [::String] + # The repeated field in the request message to be aggregated by batching. + # @!attribute [rw] discriminator_fields + # @return [::Array<::String>] + # A list of the fields in the request message. Two requests will be batched + # together only if the values of every field specified in + # `request_discriminator_fields` is equal between the two requests. + # @!attribute [rw] subresponse_field + # @return [::String] + # Optional. When present, indicates the field in the response message to be + # used to demultiplex the response into multiple response messages, in + # correspondence with the multiple request messages originally batched + # together. + class BatchingDescriptorProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + + # The behavior to take when the flow control limit is exceeded. + module FlowControlLimitExceededBehaviorProto + # Default behavior, system-defined. + UNSET_BEHAVIOR = 0 + + # Stop operation, raise error. + THROW_EXCEPTION = 1 + + # Pause operation until limit clears. + BLOCK = 2 + + # Continue operation, disregard limit. + IGNORE = 3 + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..582be187d115 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..9392a413fb1b --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..25dec4847ac1 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb @@ -0,0 +1,227 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + # to this is for Nested Collections that have stuttering names, as defined + # in [AIP-122](https://google.aip.dev/122#nested-collections), where the + # collection ID in the resource name pattern does not necessarily directly + # match the `plural` value. + # + # It is the same concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb new file mode 100644 index 000000000000..c572fd4b8154 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb @@ -0,0 +1,408 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + # An Adaptive MT Dataset. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the dataset, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` + # @!attribute [rw] display_name + # @return [::String] + # The name of the dataset to show in the interface. The name can be + # up to 32 characters long and can consist only of ASCII Latin letters A-Z + # and a-z, underscores (_), and ASCII digits 0-9. + # @!attribute [rw] source_language_code + # @return [::String] + # The BCP-47 language code of the source language. + # @!attribute [rw] target_language_code + # @return [::String] + # The BCP-47 language code of the target language. + # @!attribute [rw] example_count + # @return [::Integer] + # The number of examples in the dataset. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this dataset was created. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this dataset was last updated. + class AdaptiveMtDataset + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + #  Request message for creating an AdaptiveMtDataset. + # @!attribute [rw] parent + # @return [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @!attribute [rw] adaptive_mt_dataset + # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] + # Required. The AdaptiveMtDataset to be created. + class CreateAdaptiveMtDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for deleting an AdaptiveMtDataset. + # @!attribute [rw] name + # @return [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + class DeleteAdaptiveMtDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for getting an Adaptive MT dataset. + # @!attribute [rw] name + # @return [::String] + # Required. Name of the dataset. In the form of + # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + class GetAdaptiveMtDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for listing all Adaptive MT datasets that the requestor has + # access to. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server may return fewer results than + # requested. If unspecified, the server picks an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtDatasetsResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtDatasets` method. The first page is + # returned if `page_token`is empty or missing. + # @!attribute [rw] filter + # @return [::String] + # Optional. An expression for filtering the results of the request. + # Filter is not supported yet. + class ListAdaptiveMtDatasetsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A list of AdaptiveMtDatasets. + # @!attribute [r] adaptive_mt_datasets + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] + # Output only. A list of Adaptive MT datasets. + # @!attribute [rw] next_page_token + # @return [::String] + # Optional. A token to retrieve a page of results. Pass this value in the + # [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to + # `ListAdaptiveMtDatasets` method to retrieve the next page of results. + class ListAdaptiveMtDatasetsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request for sending an AdaptiveMt translation query. + # @!attribute [rw] parent + # @return [::String] + # Required. Location to make a regional call. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # @!attribute [rw] dataset + # @return [::String] + # Required. The resource name for the dataset to use for adaptive MT. + # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + # @!attribute [rw] content + # @return [::Array<::String>] + # Required. The content of the input in string format. + # @!attribute [rw] mime_type + # @return [::String] + # The format of the source text. + # @!attribute [rw] reference_sentence_config + # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig] + # Configuration for caller provided reference sentences. + # @!attribute [rw] glossary_config + # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::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. + class AdaptiveMtTranslateRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A pair of sentences used as reference in source and target languages. + # @!attribute [rw] source_sentence + # @return [::String] + # Source sentence in the sentence pair. + # @!attribute [rw] target_sentence + # @return [::String] + # Target sentence in the sentence pair. + class ReferenceSentencePair + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A list of reference sentence pairs. + # @!attribute [rw] reference_sentence_pairs + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentencePair>] + # Reference sentence pairs. + class ReferenceSentencePairList + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message of caller-provided reference configuration. + # @!attribute [rw] reference_sentence_pair_lists + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentencePairList>] + # Reference sentences pair lists. Each list will be used as the references + # to translate the sentence under "content" field at the corresponding + # index. Length of the list is required to be equal to the length of + # "content" field. + # @!attribute [rw] source_language_code + # @return [::String] + # Source language code. + # @!attribute [rw] target_language_code + # @return [::String] + # Target language code. + class ReferenceSentenceConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Configures which glossary is used for a specific target language and + # defines + # options for applying that glossary. + # @!attribute [rw] glossary + # @return [::String] + # Required. The `glossary` to be applied for this translation. + # + # The format depends on the glossary: + # + # - User-provided custom glossary: + # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + # @!attribute [rw] ignore_case + # @return [::Boolean] + # Optional. Indicates match is case insensitive. The default value is + # `false` if missing. + # @!attribute [rw] contextual_translation_enabled + # @return [::Boolean] + # Optional. If set to true, the glossary will be used for contextual + # translation. + class GlossaryConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # An AdaptiveMt translation. + # @!attribute [r] translated_text + # @return [::String] + # Output only. The translated text. + class AdaptiveMtTranslation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An AdaptiveMtTranslate response. + # @!attribute [r] translations + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslation>] + # Output only. The translation. + # @!attribute [r] language_code + # @return [::String] + # Output only. The translation's language code. + # @!attribute [rw] glossary_translations + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslation>] + # Text translation response if a glossary is provided in the request. This + # could be the same as 'translation' above if no terms apply. + class AdaptiveMtTranslateResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An AdaptiveMtFile. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # @!attribute [rw] display_name + # @return [::String] + # The file's display name. + # @!attribute [rw] entry_count + # @return [::Integer] + # The number of entries that the file contains. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this file was created. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this file was last updated. + class AdaptiveMtFile + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request for getting an AdaptiveMtFile. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + class GetAdaptiveMtFileRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request for deleting an AdaptiveMt file. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the file to delete, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + class DeleteAdaptiveMtFileRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request for importing an AdaptiveMt file along with its sentences. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + # @!attribute [rw] file_input_source + # @return [::Google::Cloud::Translate::V3::FileInputSource] + # Inline file source. + # + # Note: The following fields are mutually exclusive: `file_input_source`, `gcs_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] gcs_input_source + # @return [::Google::Cloud::Translate::V3::GcsInputSource] + # Google Cloud Storage file source. + # + # Note: The following fields are mutually exclusive: `gcs_input_source`, `file_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class ImportAdaptiveMtFileRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response for importing an AdaptiveMtFile + # @!attribute [r] adaptive_mt_file + # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] + # Output only. The Adaptive MT file that was imported. + class ImportAdaptiveMtFileResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request to list all AdaptiveMt files under a given dataset. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtFilesResponse.next_page_token returned from the + # previous call to `ListAdaptiveMtFiles` method. The first page is + # returned if `page_token`is empty or missing. + class ListAdaptiveMtFilesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response for listing all AdaptiveMt files under a given dataset. + # @!attribute [r] adaptive_mt_files + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtFile>] + # Output only. The Adaptive MT files. + # @!attribute [rw] next_page_token + # @return [::String] + # Optional. A token to retrieve a page of results. Pass this value in the + # ListAdaptiveMtFilesRequest.page_token field in the subsequent call to + # `ListAdaptiveMtFiles` method to retrieve the next page of results. + class ListAdaptiveMtFilesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An AdaptiveMt sentence entry. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the file, in form of + # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` + # @!attribute [rw] source_sentence + # @return [::String] + # Required. The source sentence. + # @!attribute [rw] target_sentence + # @return [::String] + # Required. The target sentence. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this sentence was created. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this sentence was last updated. + class AdaptiveMtSentence + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request for listing Adaptive MT sentences from a Dataset/File. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the project from which to list the Adaptive + # MT files. The following format lists all sentences under a file. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + # The following format lists all sentences within a dataset. + # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + # @!attribute [rw] page_size + # @return [::Integer] + # @!attribute [rw] page_token + # @return [::String] + # A token identifying a page of results the server should return. + # Typically, this is the value of + # ListAdaptiveMtSentencesRequest.next_page_token returned from the + # previous call to `ListTranslationMemories` method. The first page is + # returned if `page_token` is empty or missing. + class ListAdaptiveMtSentencesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # List AdaptiveMt sentences response. + # @!attribute [r] adaptive_mt_sentences + # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] + # Output only. The list of AdaptiveMtSentences. + # @!attribute [rw] next_page_token + # @return [::String] + # Optional. + class ListAdaptiveMtSentencesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb new file mode 100644 index 000000000000..0c1912d9abd3 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb @@ -0,0 +1,487 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + # Request message for ImportData. + # @!attribute [rw] dataset + # @return [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @!attribute [rw] input_config + # @return [::Google::Cloud::Translate::V3::DatasetInputConfig] + # Required. The config for the input content. + class ImportDataRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Input configuration for datasets. + # @!attribute [rw] input_files + # @return [::Array<::Google::Cloud::Translate::V3::DatasetInputConfig::InputFile>] + # Files containing the sentence pairs to be imported to the dataset. + class DatasetInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # An input file. + # @!attribute [rw] usage + # @return [::String] + # Optional. Usage of the file contents. Options are TRAIN|VALIDATION|TEST, + # or UNASSIGNED (by default) for auto split. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Translate::V3::GcsInputSource] + # Google Cloud Storage file source. + class InputFile + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Metadata of import data operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class ImportDataMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ExportData. + # @!attribute [rw] dataset + # @return [::String] + # Required. Name of the dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @!attribute [rw] output_config + # @return [::Google::Cloud::Translate::V3::DatasetOutputConfig] + # Required. The config for the output content. + class ExportDataRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Output configuration for datasets. + # @!attribute [rw] gcs_destination + # @return [::Google::Cloud::Translate::V3::GcsOutputDestination] + # Google Cloud Storage destination to write the output. + class DatasetOutputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata of export data operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class ExportDataMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for DeleteDataset. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the dataset to delete. + class DeleteDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata of delete dataset operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class DeleteDatasetMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for GetDataset. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the dataset to retrieve. + class GetDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListDatasets. + # @!attribute [rw] parent + # @return [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListDatasets call. + class ListDatasetsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListDatasets. + # @!attribute [rw] datasets + # @return [::Array<::Google::Cloud::Translate::V3::Dataset>] + # The datasets read. + # @!attribute [rw] next_page_token + # @return [::String] + # A token to retrieve next page of results. + # Pass this token to the page_token field in the ListDatasetsRequest to + # obtain the corresponding page. + class ListDatasetsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for CreateDataset. + # @!attribute [rw] parent + # @return [::String] + # Required. The project name. + # @!attribute [rw] dataset + # @return [::Google::Cloud::Translate::V3::Dataset] + # Required. The Dataset to create. + class CreateDatasetRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata of create dataset operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class CreateDatasetMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListExamples. + # @!attribute [rw] parent + # @return [::String] + # Required. Name of the parent dataset. In form of + # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` + # @!attribute [rw] filter + # @return [::String] + # Optional. An expression for filtering the examples that will be returned. + # Example filter: + # * `usage=TRAIN` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListExamples call. + class ListExamplesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListExamples. + # @!attribute [rw] examples + # @return [::Array<::Google::Cloud::Translate::V3::Example>] + # The sentence pairs. + # @!attribute [rw] next_page_token + # @return [::String] + # A token to retrieve next page of results. + # Pass this token to the page_token field in the ListExamplesRequest to + # obtain the corresponding page. + class ListExamplesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A sentence pair. + # @!attribute [r] name + # @return [::String] + # Output only. The resource name of the example, in form of + # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}/examples/{example_id}` + # @!attribute [rw] source_text + # @return [::String] + # Sentence in source language. + # @!attribute [rw] target_text + # @return [::String] + # Sentence in target language. + # @!attribute [r] usage + # @return [::String] + # Output only. Usage of the sentence pair. Options are TRAIN|VALIDATION|TEST. + class Example + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for BatchTransferResources. + # @!attribute [rw] responses + # @return [::Array<::Google::Cloud::Translate::V3::BatchTransferResourcesResponse::TransferResourceResponse>] + # Responses of the transfer for individual resources. + class BatchTransferResourcesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Transfer response for a single resource. + # @!attribute [rw] source + # @return [::String] + # Full name of the resource to transfer as specified in the request. + # @!attribute [rw] target + # @return [::String] + # Full name of the new resource successfully transferred from the source + # hosted by Translation API. Target will be empty if the transfer failed. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # The error result in case of failure. + class TransferResourceResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # A dataset that hosts the examples (sentence pairs) used for translation + # models. + # @!attribute [rw] name + # @return [::String] + # The resource name of the dataset, in form of + # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}` + # @!attribute [rw] display_name + # @return [::String] + # The name of the dataset to show in the interface. The name can be + # up to 32 characters long and can consist only of ASCII Latin letters A-Z + # and a-z, underscores (_), and ASCII digits 0-9. + # @!attribute [rw] source_language_code + # @return [::String] + # The BCP-47 language code of the source language. + # @!attribute [rw] target_language_code + # @return [::String] + # The BCP-47 language code of the target language. + # @!attribute [r] example_count + # @return [::Integer] + # Output only. The number of examples in the dataset. + # @!attribute [r] train_example_count + # @return [::Integer] + # Output only. Number of training examples (sentence pairs). + # @!attribute [r] validate_example_count + # @return [::Integer] + # Output only. Number of validation examples (sentence pairs). + # @!attribute [r] test_example_count + # @return [::Integer] + # Output only. Number of test examples (sentence pairs). + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this dataset was created. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this dataset was last updated. + class Dataset + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for CreateModel. + # @!attribute [rw] parent + # @return [::String] + # Required. The project name, in form of + # `projects/{project}/locations/{location}` + # @!attribute [rw] model + # @return [::Google::Cloud::Translate::V3::Model] + # Required. The Model to create. + class CreateModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata of create model operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class CreateModelMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListModels. + # @!attribute [rw] parent + # @return [::String] + # Required. Name of the parent project. In form of + # `projects/{project-number-or-id}/locations/{location-id}` + # @!attribute [rw] filter + # @return [::String] + # Optional. An expression for filtering the models that will be returned. + # Supported filter: + # `dataset_id=${dataset_id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server can return fewer results than + # requested. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results for the server to return. + # Typically obtained from next_page_token field in the response of a + # ListModels call. + class ListModelsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListModels. + # @!attribute [rw] models + # @return [::Array<::Google::Cloud::Translate::V3::Model>] + # The models read. + # @!attribute [rw] next_page_token + # @return [::String] + # A token to retrieve next page of results. + # Pass this token to the page_token field in the ListModelsRequest to + # obtain the corresponding page. + class ListModelsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for GetModel. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the model to retrieve. + class GetModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for DeleteModel. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the model to delete. + class DeleteModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata of delete model operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::OperationState] + # The current state of the operation. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # The creation time of the operation. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # The last update time of the operation. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # Only populated when operation doesn't succeed. + class DeleteModelMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A trained translation model. + # @!attribute [rw] name + # @return [::String] + # The resource name of the model, in form of + # `projects/{project-number-or-id}/locations/{location_id}/models/{model_id}` + # @!attribute [rw] display_name + # @return [::String] + # The name of the model to show in the interface. The name can be + # up to 32 characters long and can consist only of ASCII Latin letters A-Z + # and a-z, underscores (_), and ASCII digits 0-9. + # @!attribute [rw] dataset + # @return [::String] + # The dataset from which the model is trained, in form of + # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}` + # @!attribute [r] source_language_code + # @return [::String] + # Output only. The BCP-47 language code of the source language. + # @!attribute [r] target_language_code + # @return [::String] + # Output only. The BCP-47 language code of the target language. + # @!attribute [r] train_example_count + # @return [::Integer] + # Output only. Number of examples (sentence pairs) used to train the model. + # @!attribute [r] validate_example_count + # @return [::Integer] + # Output only. Number of examples (sentence pairs) used to validate the + # model. + # @!attribute [r] test_example_count + # @return [::Integer] + # Output only. Number of examples (sentence pairs) used to test the model. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when the model resource was created, which is also + # when the training started. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp when this model was last updated. + class Model + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb new file mode 100644 index 000000000000..2309b07edac1 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb @@ -0,0 +1,143 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + # The Google Cloud Storage location for the input content. + # @!attribute [rw] input_uri + # @return [::String] + # Required. Source data URI. For example, `gs://my_bucket/my_object`. + class GcsInputSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An inlined file. + # @!attribute [rw] mime_type + # @return [::String] + # Required. The file's mime type. + # @!attribute [rw] content + # @return [::String] + # Required. The file's byte contents. + # @!attribute [rw] display_name + # @return [::String] + # Required. The file's display name. + class FileInputSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The Google Cloud Storage location for the output content. + # @!attribute [rw] output_uri_prefix + # @return [::String] + # Required. Google Cloud Storage URI to output directory. For example, + # `gs://bucket/directory`. The requesting user must have write permission to + # the bucket. The directory will be created if it doesn't exist. + class GcsOutputDestination + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a single entry in a glossary. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of the entry. + # Format: + # `projects/*/locations/*/glossaries/*/glossaryEntries/*` + # @!attribute [rw] terms_pair + # @return [::Google::Cloud::Translate::V3::GlossaryEntry::GlossaryTermsPair] + # Used for an unidirectional glossary. + # + # Note: The following fields are mutually exclusive: `terms_pair`, `terms_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] terms_set + # @return [::Google::Cloud::Translate::V3::GlossaryEntry::GlossaryTermsSet] + # Used for an equivalent term sets glossary. + # + # Note: The following fields are mutually exclusive: `terms_set`, `terms_pair`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] description + # @return [::String] + # Describes the glossary entry. + class GlossaryEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Represents a single entry for an unidirectional glossary. + # @!attribute [rw] source_term + # @return [::Google::Cloud::Translate::V3::GlossaryTerm] + # The source term is the term that will get match in the text, + # @!attribute [rw] target_term + # @return [::Google::Cloud::Translate::V3::GlossaryTerm] + # The term that will replace the match source term. + class GlossaryTermsPair + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a single entry for an equivalent term set glossary. This is used + # for equivalent term sets where each term can be replaced by the other terms + # in the set. + # @!attribute [rw] terms + # @return [::Array<::Google::Cloud::Translate::V3::GlossaryTerm>] + # Each term in the set represents a term that can be replaced by the other + # terms. + class GlossaryTermsSet + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Represents a single glossary term + # @!attribute [rw] language_code + # @return [::String] + # The language for this glossary term. + # @!attribute [rw] text + # @return [::String] + # The text for the glossary term. + class GlossaryTerm + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Possible states of long running operations. + module OperationState + # Invalid. + OPERATION_STATE_UNSPECIFIED = 0 + + # Request is being processed. + OPERATION_STATE_RUNNING = 1 + + # The operation was successful. + OPERATION_STATE_SUCCEEDED = 2 + + # Failed to process operation. + OPERATION_STATE_FAILED = 3 + + # Request is in the process of being canceled after caller invoked + # longrunning.Operations.CancelOperation on the request id. + OPERATION_STATE_CANCELLING = 4 + + # The operation request was successfully canceled. + OPERATION_STATE_CANCELLED = 5 + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb new file mode 100644 index 000000000000..314073d5ff59 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb @@ -0,0 +1,1657 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Translate + module V3 + # Configures transliteration feature on top of translation. + # @!attribute [rw] enable_transliteration + # @return [::Boolean] + # If true, source text in romanized form can be translated to the target + # language. + class TransliterationConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for synchronous translation. + # @!attribute [rw] contents + # @return [::Array<::String>] + # Required. The content of the input in string format. + # We recommend the total content be less than 30,000 codepoints. The max + # length of this field is 1024. Use BatchTranslateText for larger text. + # @!attribute [rw] mime_type + # @return [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @!attribute [rw] source_language_code + # @return [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "en-US" or "sr-Latn". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). If the source + # language isn't specified, the API attempts to identify the source language + # automatically and returns the source language within the response. + # @!attribute [rw] target_language_code + # @return [::String] + # Required. The ISO-639 language code to use for translation of the input + # text, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] parent + # @return [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 same + # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + # @!attribute [rw] model + # @return [::String] + # 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`, + # + # - Translation LLM models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, + # + # For global (non-regionalized) requests, use `location-id` `global`. + # For example, + # `projects/{project-number-or-id}/locations/global/models/general/nmt`. + # + # If not provided, the default Google model (NMT) will be used + # @!attribute [rw] glossary_config + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + # Optional. Glossary to be applied. The glossary must be + # within the same region (have the same location-id) as the model, otherwise + # an INVALID_ARGUMENT (400) error is returned. + # @!attribute [rw] transliteration_config + # @return [::Google::Cloud::Translate::V3::TransliterationConfig] + # Optional. Transliteration to be applied. + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + class TranslateTextRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # @!attribute [rw] translations + # @return [::Array<::Google::Cloud::Translate::V3::Translation>] + # Text translation responses with no glossary applied. + # This field has the same length as + # {::Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}. + # @!attribute [rw] glossary_translations + # @return [::Array<::Google::Cloud::Translate::V3::Translation>] + # Text translation responses if a glossary is provided in the request. + # This can be the same as + # {::Google::Cloud::Translate::V3::TranslateTextResponse#translations `translations`} + # if no terms apply. This field has the same length as + # {::Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}. + class TranslateTextResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A single translation response. + # @!attribute [rw] translated_text + # @return [::String] + # Text translated into the target language. + # If an error occurs during translation, this field might be excluded from + # the response. + # @!attribute [rw] model + # @return [::String] + # Only present when `model` is present in the request. + # `model` here is normalized to have project number. + # + # For example: + # If the `model` requested in TranslationTextRequest 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`. + # @!attribute [rw] detected_language_code + # @return [::String] + # The ISO-639 language code of source text in the initial request, detected + # automatically, if no source language was passed within the initial + # request. If the source language was passed, auto-detection of the language + # does not occur and this field is empty. + # @!attribute [rw] glossary_config + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + # The `glossary_config` used for this translation. + class Translation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for synchronous romanization. + # @!attribute [rw] parent + # @return [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # @!attribute [rw] contents + # @return [::Array<::String>] + # Required. The content of the input in string format. + # @!attribute [rw] source_language_code + # @return [::String] + # Optional. The ISO-639 language code of the input text if + # known, for example, "hi" or "zh". Supported language codes are + # listed in [Language + # Support](https://cloud.google.com/translate/docs/languages#roman). If the + # source language isn't specified, the API attempts to identify the source + # language automatically and returns the source language for each content in + # the response. + class RomanizeTextRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A single romanization response. + # @!attribute [rw] romanized_text + # @return [::String] + # Romanized text. + # If an error occurs during romanization, this field might be excluded from + # the response. + # @!attribute [rw] detected_language_code + # @return [::String] + # The ISO-639 language code of source text in the initial request, detected + # automatically, if no source language was passed within the initial + # request. If the source language was passed, auto-detection of the language + # does not occur and this field is empty. + class Romanization + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for synchronous romanization. + # @!attribute [rw] romanizations + # @return [::Array<::Google::Cloud::Translate::V3::Romanization>] + # Text romanization responses. + # This field has the same length as + # {::Google::Cloud::Translate::V3::RomanizeTextRequest#contents `contents`}. + class RomanizeTextResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for language detection. + # @!attribute [rw] parent + # @return [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}` or + # `projects/{project-number-or-id}`. + # + # For global calls, use `projects/{project-number-or-id}/locations/global` or + # `projects/{project-number-or-id}`. + # + # Only models within the same region (has same location-id) can be used. + # Otherwise an INVALID_ARGUMENT (400) error is returned. + # @!attribute [rw] model + # @return [::String] + # Optional. The language detection model to be used. + # + # Format: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + # + # Only one language detection model is currently supported: + # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + # + # If not specified, the default model is used. + # @!attribute [rw] content + # @return [::String] + # The content of the input stored as a string. + # @!attribute [rw] mime_type + # @return [::String] + # Optional. The format of the source text, for example, "text/html", + # "text/plain". If left blank, the MIME type defaults to "text/html". + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + class DetectLanguageRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The response message for language detection. + # @!attribute [rw] language_code + # @return [::String] + # The ISO-639 language code of the source content in the request, detected + # automatically. + # @!attribute [rw] confidence + # @return [::Float] + # The confidence of the detection result for this language. + class DetectedLanguage + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for language detection. + # @!attribute [rw] languages + # @return [::Array<::Google::Cloud::Translate::V3::DetectedLanguage>] + # The most probable language detected by the Translation API. For each + # request, the Translation API will always return only one result. + class DetectLanguageResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for discovering supported languages. + # @!attribute [rw] parent + # @return [::String] + # Required. Project or location to make a call. Must refer to a caller's + # project. + # + # Format: `projects/{project-number-or-id}` or + # `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 AutoML models. + # + # Only models within the same region (have same location-id) can be used, + # otherwise an INVALID_ARGUMENT (400) error is returned. + # @!attribute [rw] display_language_code + # @return [::String] + # Optional. The language to use to return localized, human readable names + # of supported languages. If missing, then display names are not returned + # in a response. + # @!attribute [rw] model + # @return [::String] + # Optional. Get supported languages of this model. + # + # 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`, + # + # + # Returns languages supported by the specified model. + # If missing, we get supported languages of Google general NMT model. + class GetSupportedLanguagesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for discovering supported languages. + # @!attribute [rw] languages + # @return [::Array<::Google::Cloud::Translate::V3::SupportedLanguage>] + # A list of supported language responses. This list contains an entry + # for each language the Translation API supports. + class SupportedLanguages + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A single supported language response corresponds to information related + # to one supported language. + # @!attribute [rw] language_code + # @return [::String] + # Supported language code, generally consisting of its ISO 639-1 + # identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + # including language and region identifiers are returned (for example, + # 'zh-TW' and 'zh-CN'). + # @!attribute [rw] display_name + # @return [::String] + # Human-readable name of the language localized in the display language + # specified in the request. + # @!attribute [rw] support_source + # @return [::Boolean] + # Can be used as a source language. + # @!attribute [rw] support_target + # @return [::Boolean] + # Can be used as a target language. + class SupportedLanguage + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The Google Cloud Storage location for the input content. + # @!attribute [rw] input_uri + # @return [::String] + # Required. Source data URI. For example, `gs://my_bucket/my_object`. + class GcsSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Input configuration for BatchTranslateText request. + # @!attribute [rw] mime_type + # @return [::String] + # Optional. Can be "text/plain" or "text/html". + # For `.tsv`, "text/html" is used if mime_type is missing. + # For `.html`, this field must be "text/html" or empty. + # For `.txt`, this field must be "text/plain" or empty. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Translate::V3::GcsSource] + # Required. Google Cloud Storage location for the source input. + # This can be a single file (for example, + # `gs://translation-test/input.tsv`) or a wildcard (for example, + # `gs://translation-test/*`). If a file extension is `.tsv`, it can + # contain either one or two columns. The first column (optional) is the id + # of the text request. If the first column is missing, we use the row + # number (0-based) from the input file as the ID in the output file. The + # second column is the actual text to be + # translated. We recommend each row be <= 10K Unicode codepoints, + # otherwise an error might be returned. + # Note that the input tsv must be RFC 4180 compliant. + # + # You could use https://github.com/Clever/csvlint to check potential + # formatting errors in your tsv file. + # csvlint --delimiter='\t' your_input_file.tsv + # + # The other supported file extensions are `.txt` or `.html`, which is + # treated as a single large chunk of text. + class InputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The Google Cloud Storage location for the output content. + # @!attribute [rw] output_uri_prefix + # @return [::String] + # 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. + class GcsDestination + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Output configuration for BatchTranslateText request. + # @!attribute [rw] gcs_destination + # @return [::Google::Cloud::Translate::V3::GcsDestination] + # Google Cloud Storage destination for output content. + # For every single input file (for example, gs://a/b/c.[extension]), we + # generate at most 2 * n output files. (n is the # of target_language_codes + # in the BatchTranslateTextRequest). + # + # Output files (tsv) generated are compliant with RFC 4180 except that + # record delimiters are '\n' instead of '\r\n'. We don't provide any way to + # change record delimiters. + # + # While the input files are being processed, we write/update an index file + # 'index.csv' under 'output_uri_prefix' (for example, + # gs://translation-test/index.csv) The index file is generated/updated as + # new files are being translated. The format is: + # + # input_file,target_language_code,translations_file,errors_file, + # glossary_translations_file,glossary_errors_file + # + # input_file is one file we matched using gcs_source.input_uri. + # target_language_code is provided in the request. + # translations_file contains the translations. (details provided below) + # errors_file contains the errors during processing of the file. (details + # below). Both translations_file and errors_file could be empty + # strings if we have no content to output. + # glossary_translations_file and glossary_errors_file are always empty + # strings if the input_file is tsv. 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#retention-policy) + # + # The format of translations_file (for target language code 'trg') is: + # `gs://translation_test/a_b_c_'trg'_translations.[extension]` + # + # If the input file extension is tsv, the output has the following + # columns: + # Column 1: ID of the request provided in the input, if it's not + # provided in the input, then the input row number is used (0-based). + # Column 2: source sentence. + # Column 3: translation without applying a glossary. Empty string if there + # is an error. + # Column 4 (only present if a glossary is provided in the request): + # translation after applying the glossary. Empty string if there is an + # error applying the glossary. Could be same string as column 3 if there is + # no glossary applied. + # + # 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]` + # + # The format of errors file (for target language code 'trg') is: + # `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 + # provided in the input, then the input row number is used (0-based). + # Column 2: source sentence. + # Column 3: Error detail for the translation. Could be empty. + # Column 4 (only present if a glossary is provided in the request): + # Error when applying the glossary. + # + # 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]` + class OutputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A document translation request input config. + # @!attribute [rw] content + # @return [::String] + # Document's content represented as a stream of bytes. + # + # Note: The following fields are mutually exclusive: `content`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Translate::V3::GcsSource] + # Google Cloud Storage location. This must be a single file. + # For example: gs://example_bucket/example_file.pdf + # + # Note: The following fields are mutually exclusive: `gcs_source`, `content`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] mime_type + # @return [::String] + # 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 + class DocumentInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A document translation request output config. + # @!attribute [rw] gcs_destination + # @return [::Google::Cloud::Translate::V3::GcsDestination] + # 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. + # @!attribute [rw] mime_type + # @return [::String] + # 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 + class DocumentOutputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A document translation request. + # @!attribute [rw] parent + # @return [::String] + # 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. + # @!attribute [rw] source_language_code + # @return [::String] + # Optional. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). 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. + # @!attribute [rw] target_language_code + # @return [::String] + # Required. The ISO-639 language code to use for translation of the input + # document, set to one of the language codes listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] document_input_config + # @return [::Google::Cloud::Translate::V3::DocumentInputConfig] + # Required. Input configurations. + # @!attribute [rw] document_output_config + # @return [::Google::Cloud::Translate::V3::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. + # @!attribute [rw] model + # @return [::String] + # 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. + # @!attribute [rw] glossary_config + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + # Optional. Glossary to be applied. The glossary must be within the same + # region (have the same location-id) as the model, otherwise an + # INVALID_ARGUMENT (400) error is returned. + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters (Unicode + # codepoints), can only contain lowercase letters, numeric characters, + # underscores and dashes. International characters are allowed. Label values + # are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + # @!attribute [rw] customized_attribution + # @return [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @!attribute [rw] is_translate_native_pdf_only + # @return [::Boolean] + # Optional. is_translate_native_pdf_only field for external customers. + # If true, the page limit of online native pdf translation is 300 and only + # native pdf pages will be translated. + # @!attribute [rw] enable_shadow_removal_native_pdf + # @return [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @!attribute [rw] enable_rotation_correction + # @return [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + class TranslateDocumentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # A translated document message. + # @!attribute [rw] byte_stream_outputs + # @return [::Array<::String>] + # 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. + # @!attribute [rw] mime_type + # @return [::String] + # The translated document's mime type. + # @!attribute [rw] detected_language_code + # @return [::String] + # 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. + class DocumentTranslation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A translated document response message. + # @!attribute [rw] document_translation + # @return [::Google::Cloud::Translate::V3::DocumentTranslation] + # Translated document. + # @!attribute [rw] glossary_document_translation + # @return [::Google::Cloud::Translate::V3::DocumentTranslation] + # 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. + # @!attribute [rw] model + # @return [::String] + # 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`. + # @!attribute [rw] glossary_config + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + # The `glossary_config` used for this translation. + class TranslateDocumentResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The batch translation request. + # @!attribute [rw] parent + # @return [::String] + # Required. Location to make a call. Must refer to a caller's project. + # + # Format: `projects/{project-number-or-id}/locations/{location-id}`. + # + # The `global` location is not supported for batch translation. + # + # Only AutoML Translation models or glossaries within the same region (have + # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + # error is returned. + # @!attribute [rw] source_language_code + # @return [::String] + # Required. Source language code. Supported language codes are listed in + # [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] target_language_codes + # @return [::Array<::String>] + # Required. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] models + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The models to use for translation. Map's key is target language + # code. Map's value is model name. Value can be a built-in general model, + # or an AutoML Translation model. + # + # The value format depends on model type: + # + # - AutoML Translation models: + # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + # + # - General (built-in) models: + # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + # + # + # If the map is empty or a specific model is + # not requested for a language pair, then default google model (nmt) is used. + # @!attribute [rw] input_configs + # @return [::Array<::Google::Cloud::Translate::V3::InputConfig>] + # Required. Input configurations. + # The total number of files matched should be <= 100. + # The total content size should be <= 100M Unicode codepoints. + # The files must use UTF-8 encoding. + # @!attribute [rw] output_config + # @return [::Google::Cloud::Translate::V3::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. + # @!attribute [rw] glossaries + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}] + # Optional. Glossaries to be applied for translation. + # It's keyed by target language code. + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The labels with user-defined metadata for the request. + # + # Label keys and values can be no longer than 63 characters + # (Unicode codepoints), can only contain lowercase letters, numeric + # characters, underscores and dashes. International characters are allowed. + # Label values are optional. Label keys must start with a letter. + # + # See https://cloud.google.com/translate/docs/advanced/labels for more + # information. + class BatchTranslateTextRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ModelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + class GlossariesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # State metadata for the batch translation operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::BatchTranslateMetadata::State] + # The state of the operation. + # @!attribute [rw] translated_characters + # @return [::Integer] + # Number of successfully translated characters so far (Unicode codepoints). + # @!attribute [rw] failed_characters + # @return [::Integer] + # Number of characters that have failed to process so far (Unicode + # codepoints). + # @!attribute [rw] total_characters + # @return [::Integer] + # Total number of characters (Unicode codepoints). + # This is the total number of codepoints from input files times the number of + # target languages and appears here shortly after the call is submitted. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # Time when the operation was submitted. + class BatchTranslateMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # State of the job. + module 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 + end + end + + # Stored in the + # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} + # field returned by BatchTranslateText if at least one sentence is translated + # successfully. + # @!attribute [rw] total_characters + # @return [::Integer] + # Total number of characters (Unicode codepoints). + # @!attribute [rw] translated_characters + # @return [::Integer] + # Number of successfully translated characters (Unicode codepoints). + # @!attribute [rw] failed_characters + # @return [::Integer] + # Number of characters that have failed to process (Unicode codepoints). + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # Time when the operation was submitted. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation is finished and + # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is + # set to true. + class BatchTranslateResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Input configuration for glossaries. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Translate::V3::GcsSource] + # Required. Google Cloud Storage location of glossary data. + # File format is determined based on the filename extension. API returns + # [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + # formats. Wildcards are not allowed. This must be a single file in one of + # the following formats: + # + # For unidirectional glossaries: + # + # - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + # The first column is source text. The second column is target text. + # No headers in this file. The first row contains data and not column + # names. + # + # - TMX (`.tmx`): TMX file with parallel data defining source/target term + # pairs. + # + # For equivalent term sets glossaries: + # + # - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + # in multiple languages. See documentation for more information - + # [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + class GlossaryInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Represents a glossary built from user-provided data. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the glossary. Glossary names have the form + # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + # @!attribute [rw] language_pair + # @return [::Google::Cloud::Translate::V3::Glossary::LanguageCodePair] + # Used with unidirectional glossaries. + # + # Note: The following fields are mutually exclusive: `language_pair`, `language_codes_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] language_codes_set + # @return [::Google::Cloud::Translate::V3::Glossary::LanguageCodesSet] + # Used with equivalent term set glossaries. + # + # Note: The following fields are mutually exclusive: `language_codes_set`, `language_pair`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] input_config + # @return [::Google::Cloud::Translate::V3::GlossaryInputConfig] + # Required. Provides examples to build the glossary from. + # Total glossary must not exceed 10M Unicode codepoints. + # @!attribute [r] entry_count + # @return [::Integer] + # Output only. The number of entries defined in the glossary. + # @!attribute [r] submit_time + # @return [::Google::Protobuf::Timestamp] + # Output only. When CreateGlossary was called. + # @!attribute [r] end_time + # @return [::Google::Protobuf::Timestamp] + # Output only. When the glossary creation was finished. + # @!attribute [rw] display_name + # @return [::String] + # Optional. The display name of the glossary. + class Glossary + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Used with unidirectional glossaries. + # @!attribute [rw] source_language_code + # @return [::String] + # Required. The ISO-639 language code of the input text, for example, + # "en-US". Expected to be an exact match for GlossaryTerm.language_code. + # @!attribute [rw] target_language_code + # @return [::String] + # Required. The ISO-639 language code for translation output, for example, + # "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + class LanguageCodePair + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Used with equivalent term set glossaries. + # @!attribute [rw] language_codes + # @return [::Array<::String>] + # The ISO-639 language code(s) for terms defined in the glossary. + # All entries are unique. The list contains at least two entries. + # Expected to be an exact match for GlossaryTerm.language_code. + class LanguageCodesSet + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Request message for CreateGlossary. + # @!attribute [rw] parent + # @return [::String] + # Required. The project name. + # @!attribute [rw] glossary + # @return [::Google::Cloud::Translate::V3::Glossary] + # Required. The glossary to create. + class CreateGlossaryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the update glossary flow + # @!attribute [rw] glossary + # @return [::Google::Cloud::Translate::V3::Glossary] + # Required. The glossary entry to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # The list of fields to be updated. Currently only `display_name` and + # 'input_config' + class UpdateGlossaryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for GetGlossary. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the glossary to retrieve. + class GetGlossaryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for DeleteGlossary. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the glossary to delete. + class DeleteGlossaryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListGlossaries. + # @!attribute [rw] parent + # @return [::String] + # Required. The name of the project from which to list all of the glossaries. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server may return fewer glossaries than + # requested. If unspecified, the server picks an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of [ListGlossariesResponse.next_page_token] + # returned from the previous call to `ListGlossaries` method. + # The first page is returned if `page_token`is empty or missing. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filter specifying constraints of a list operation. + # 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. + class ListGlossariesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListGlossaries. + # @!attribute [rw] glossaries + # @return [::Array<::Google::Cloud::Translate::V3::Glossary>] + # The list of glossaries for a project. + # @!attribute [rw] next_page_token + # @return [::String] + # A token to retrieve a page of results. Pass this value in the + # [ListGlossariesRequest.page_token] field in the subsequent call to + # `ListGlossaries` method to retrieve the next page of results. + class ListGlossariesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the Get Glossary Entry Api + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the glossary entry to get + class GetGlossaryEntryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for Delete Glossary Entry + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the glossary entry to delete + class DeleteGlossaryEntryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ListGlossaryEntries + # @!attribute [rw] parent + # @return [::String] + # Required. The parent glossary resource name for listing the glossary's + # entries. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Requested page size. The server may return fewer glossary entries + # than requested. If unspecified, the server picks an appropriate default. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A token identifying a page of results the server should return. + # Typically, this is the value of + # [ListGlossaryEntriesResponse.next_page_token] returned from the previous + # call. The first page is returned if `page_token`is empty or missing. + class ListGlossaryEntriesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for ListGlossaryEntries + # @!attribute [rw] glossary_entries + # @return [::Array<::Google::Cloud::Translate::V3::GlossaryEntry>] + # Optional. The Glossary Entries + # @!attribute [rw] next_page_token + # @return [::String] + # Optional. A token to retrieve a page of results. Pass this value in the + # [ListGLossaryEntriesRequest.page_token] field in the subsequent calls. + class ListGlossaryEntriesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for CreateGlossaryEntry + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the glossary to create the entry under. + # @!attribute [rw] glossary_entry + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # Required. The glossary entry to create + class CreateGlossaryEntryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for UpdateGlossaryEntry + # @!attribute [rw] glossary_entry + # @return [::Google::Cloud::Translate::V3::GlossaryEntry] + # Required. The glossary entry to update. + class UpdateGlossaryEntryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Stored in the + # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} + # field returned by CreateGlossary. + # @!attribute [rw] name + # @return [::String] + # The name of the glossary that is being created. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::CreateGlossaryMetadata::State] + # The current state of the glossary creation operation. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation was submitted to the server. + class CreateGlossaryMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enumerates the possible states that the creation request can be in. + module State + # Invalid. + STATE_UNSPECIFIED = 0 + + # Request is being processed. + RUNNING = 1 + + # The glossary was successfully created. + SUCCEEDED = 2 + + # Failed to create the glossary. + FAILED = 3 + + # Request is in the process of being canceled after caller invoked + # longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4 + + # The glossary creation request was successfully canceled. + CANCELLED = 5 + end + end + + # Stored in the + # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} + # field returned by UpdateGlossary. + # @!attribute [rw] glossary + # @return [::Google::Cloud::Translate::V3::Glossary] + # The updated glossary object. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::UpdateGlossaryMetadata::State] + # The current state of the glossary update operation. If the glossary input + # file was not updated this will be completed immediately + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation was submitted to the server. + class UpdateGlossaryMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enumerates the possible states that the update request can be in. + module State + # Invalid. + STATE_UNSPECIFIED = 0 + + # Request is being processed. + RUNNING = 1 + + # The glossary was successfully updated. + SUCCEEDED = 2 + + # Failed to update the glossary. + FAILED = 3 + + # Request is in the process of being canceled after caller invoked + # longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4 + + # The glossary update request was successfully canceled. + CANCELLED = 5 + end + end + + # Stored in the + # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} + # field returned by DeleteGlossary. + # @!attribute [rw] name + # @return [::String] + # The name of the glossary that is being deleted. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::DeleteGlossaryMetadata::State] + # The current state of the glossary deletion operation. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation was submitted to the server. + class DeleteGlossaryMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enumerates the possible states that the creation request can be in. + module State + # Invalid. + STATE_UNSPECIFIED = 0 + + # Request is being processed. + RUNNING = 1 + + # The glossary was successfully deleted. + SUCCEEDED = 2 + + # Failed to delete the glossary. + FAILED = 3 + + # Request is in the process of being canceled after caller invoked + # longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4 + + # The glossary deletion request was successfully canceled. + CANCELLED = 5 + end + end + + # Stored in the + # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} + # field returned by DeleteGlossary. + # @!attribute [rw] name + # @return [::String] + # The name of the deleted glossary. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation was submitted to the server. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # The time when the glossary deletion is finished and + # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is + # set to true. + class DeleteGlossaryResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The BatchTranslateDocument request. + # @!attribute [rw] parent + # @return [::String] + # 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. + # @!attribute [rw] source_language_code + # @return [::String] + # Required. The ISO-639 language code of the input document if known, for + # example, "en-US" or "sr-Latn". Supported language codes are listed in + # [Language Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] target_language_codes + # @return [::Array<::String>] + # Required. The ISO-639 language code to use for translation of the input + # document. Specify up to 10 language codes here. Supported language codes + # are listed in [Language + # Support](https://cloud.google.com/translate/docs/languages). + # @!attribute [rw] input_configs + # @return [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig>] + # 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. + # @!attribute [rw] output_config + # @return [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig] + # 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. + # @!attribute [rw] models + # @return [::Google::Protobuf::Map{::String => ::String}] + # 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. + # @!attribute [rw] glossaries + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}] + # Optional. Glossaries to be applied. It's keyed by target language code. + # @!attribute [rw] format_conversions + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The file format conversion map that is applied to all input + # files. The map key is the original mime_type. The map 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. + # @!attribute [rw] customized_attribution + # @return [::String] + # Optional. This flag is to support user customized attribution. + # If not provided, the default is `Machine Translated by Google`. + # Customized attribution should follow rules in + # https://cloud.google.com/translate/attribution#attribution_and_logos + # @!attribute [rw] enable_shadow_removal_native_pdf + # @return [::Boolean] + # Optional. If true, use the text removal server to remove the shadow text on + # background image for native pdf translation. + # Shadow removal feature can only be enabled when + # is_translate_native_pdf_only: false && pdf_native_only: false + # @!attribute [rw] enable_rotation_correction + # @return [::Boolean] + # Optional. If true, enable auto rotation correction in DVS. + class BatchTranslateDocumentRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ModelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] + class GlossariesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class FormatConversionsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Input configuration for BatchTranslateDocument request. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Translate::V3::GcsSource] + # 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. + class BatchDocumentInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Output configuration for BatchTranslateDocument request. + # @!attribute [rw] gcs_destination + # @return [::Google::Cloud::Translate::V3::GcsDestination] + # 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#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. + class BatchDocumentOutputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Stored in the + # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} + # field returned by BatchTranslateDocument if at least one document is + # translated successfully. + # @!attribute [rw] total_pages + # @return [::Integer] + # Total number of pages to translate in all documents. Documents without + # clear page definition (such as XLSX) are not counted. + # @!attribute [rw] translated_pages + # @return [::Integer] + # Number of successfully translated pages in all documents. Documents without + # clear page definition (such as XLSX) are not counted. + # @!attribute [rw] failed_pages + # @return [::Integer] + # Number of pages that failed to process in all documents. Documents without + # clear page definition (such as XLSX) are not counted. + # @!attribute [rw] total_billable_pages + # @return [::Integer] + # Number of billable pages in documents with clear page definition (such as + # PDF, DOCX, PPTX) + # @!attribute [rw] total_characters + # @return [::Integer] + # Total number of characters (Unicode codepoints) in all documents. + # @!attribute [rw] translated_characters + # @return [::Integer] + # Number of successfully translated characters (Unicode codepoints) in all + # documents. + # @!attribute [rw] failed_characters + # @return [::Integer] + # Number of characters that have failed to process (Unicode codepoints) in + # all documents. + # @!attribute [rw] total_billable_characters + # @return [::Integer] + # Number of billable characters (Unicode codepoints) in documents without + # clear page definition, such as XLSX. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # Time when the operation was submitted. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # The time when the operation is finished and + # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is + # set to true. + class BatchTranslateDocumentResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # State metadata for the batch translation operation. + # @!attribute [rw] state + # @return [::Google::Cloud::Translate::V3::BatchTranslateDocumentMetadata::State] + # The state of the operation. + # @!attribute [rw] total_pages + # @return [::Integer] + # Total number of pages to translate in all documents so far. Documents + # without clear page definition (such as XLSX) are not counted. + # @!attribute [rw] translated_pages + # @return [::Integer] + # Number of successfully translated pages in all documents so far. Documents + # without clear page definition (such as XLSX) are not counted. + # @!attribute [rw] failed_pages + # @return [::Integer] + # Number of pages that failed to process in all documents so far. Documents + # without clear page definition (such as XLSX) are not counted. + # @!attribute [rw] total_billable_pages + # @return [::Integer] + # Number of billable pages in documents with clear page definition (such as + # PDF, DOCX, PPTX) so far. + # @!attribute [rw] total_characters + # @return [::Integer] + # Total number of characters (Unicode codepoints) in all documents so far. + # @!attribute [rw] translated_characters + # @return [::Integer] + # Number of successfully translated characters (Unicode codepoints) in all + # documents so far. + # @!attribute [rw] failed_characters + # @return [::Integer] + # Number of characters that have failed to process (Unicode codepoints) in + # all documents so far. + # @!attribute [rw] total_billable_characters + # @return [::Integer] + # Number of billable characters (Unicode codepoints) in documents without + # clear page definition (such as XLSX) so far. + # @!attribute [rw] submit_time + # @return [::Google::Protobuf::Timestamp] + # Time when the operation was submitted. + class BatchTranslateDocumentMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # State of the job. + module 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 + end + end + + # Configures which glossary is used for a specific target language and defines + # options for applying that glossary. + # @!attribute [rw] glossary + # @return [::String] + # Required. The `glossary` to be applied for this translation. + # + # The format depends on the glossary: + # + # - User-provided custom glossary: + # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + # @!attribute [rw] ignore_case + # @return [::Boolean] + # Optional. Indicates match is case insensitive. The default value is `false` + # if missing. + # @!attribute [rw] contextual_translation_enabled + # @return [::Boolean] + # Optional. If set to true, the glossary will be used for contextual + # translation. + class TranslateTextGlossaryConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb new file mode 100644 index 000000000000..7a757f512165 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb @@ -0,0 +1,191 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Longrunning + # This resource represents a long-running operation that is the result of a + # network API call. + # @!attribute [rw] name + # @return [::String] + # The server-assigned name, which is only unique within the same service that + # originally returns it. If you use the default HTTP mapping, the + # `name` should be a resource name ending with `operations/{unique_id}`. + # @!attribute [rw] metadata + # @return [::Google::Protobuf::Any] + # Service-specific metadata associated with the operation. It typically + # contains progress information and common metadata such as create time. + # Some services might not provide such metadata. Any method that returns a + # long-running operation should document the metadata type, if any. + # @!attribute [rw] done + # @return [::Boolean] + # If the value is `false`, it means the operation is still in progress. + # If `true`, the operation is completed, and either `error` or `response` is + # available. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # The error result of the operation in case of failure or cancellation. + # + # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] response + # @return [::Google::Protobuf::Any] + # The normal, successful response of the operation. If the original + # method returns no data on success, such as `Delete`, the response is + # `google.protobuf.Empty`. If the original method is standard + # `Get`/`Create`/`Update`, the response should be the resource. For other + # methods, the response should have the type `XxxResponse`, where `Xxx` + # is the original method name. For example, if the original method name + # is `TakeSnapshot()`, the inferred response type is + # `TakeSnapshotResponse`. + # + # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class Operation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.GetOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource. + class GetOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.ListOperations. + # @!attribute [rw] name + # @return [::String] + # The name of the operation's parent resource. + # @!attribute [rw] filter + # @return [::String] + # The standard list filter. + # @!attribute [rw] page_size + # @return [::Integer] + # The standard list page size. + # @!attribute [rw] page_token + # @return [::String] + # The standard list page token. + # @!attribute [rw] return_partial_success + # @return [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + class ListOperationsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for + # Operations.ListOperations. + # @!attribute [rw] operations + # @return [::Array<::Google::Longrunning::Operation>] + # A list of operations that matches the specified filter in the request. + # @!attribute [rw] next_page_token + # @return [::String] + # The standard List next-page token. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Unordered list. Unreachable resources. Populated when the request sets + # `ListOperationsRequest.return_partial_success` and reads across + # collections e.g. when attempting to list all resources across all supported + # locations. + class ListOperationsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.CancelOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be cancelled. + class CancelOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.DeleteOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be deleted. + class DeleteOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.WaitOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to wait on. + # @!attribute [rw] timeout + # @return [::Google::Protobuf::Duration] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + class WaitOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A message representing the message types used by a long-running operation. + # + # Example: + # + # rpc Export(ExportRequest) returns (google.longrunning.Operation) { + # option (google.longrunning.operation_info) = { + # response_type: "ExportResponse" + # metadata_type: "ExportMetadata" + # }; + # } + # @!attribute [rw] response_type + # @return [::String] + # Required. The message name of the primary return type for this + # long-running operation. + # This type will be used to deserialize the LRO's response. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + # @!attribute [rw] metadata_type + # @return [::String] + # Required. The message name of the metadata type for this long-running + # operation. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + class OperationInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb new file mode 100644 index 000000000000..58691995f02e --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb @@ -0,0 +1,145 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `Any` contains an arbitrary serialized protocol buffer message along with a + # URL that describes the type of the serialized message. + # + # Protobuf library provides support to pack/unpack Any values in the form + # of utility functions or additional generated methods of the Any type. + # + # Example 1: Pack and unpack a message in C++. + # + # Foo foo = ...; + # Any any; + # any.PackFrom(foo); + # ... + # if (any.UnpackTo(&foo)) { + # ... + # } + # + # Example 2: Pack and unpack a message in Java. + # + # Foo foo = ...; + # Any any = Any.pack(foo); + # ... + # if (any.is(Foo.class)) { + # foo = any.unpack(Foo.class); + # } + # // or ... + # if (any.isSameTypeAs(Foo.getDefaultInstance())) { + # foo = any.unpack(Foo.getDefaultInstance()); + # } + # + # Example 3: Pack and unpack a message in Python. + # + # foo = Foo(...) + # any = Any() + # any.Pack(foo) + # ... + # if any.Is(Foo.DESCRIPTOR): + # any.Unpack(foo) + # ... + # + # Example 4: Pack and unpack a message in Go + # + # foo := &pb.Foo{...} + # any, err := anypb.New(foo) + # if err != nil { + # ... + # } + # ... + # foo := &pb.Foo{} + # if err := any.UnmarshalTo(foo); err != nil { + # ... + # } + # + # The pack methods provided by protobuf library will by default use + # 'type.googleapis.com/full.type.name' as the type URL and the unpack + # methods only use the fully qualified type name after the last '/' + # in the type URL, for example "foo.bar.com/x/y.z" will yield type + # name "y.z". + # + # JSON + # ==== + # The JSON representation of an `Any` value uses the regular + # representation of the deserialized, embedded message, with an + # additional field `@type` which contains the type URL. Example: + # + # package google.profile; + # message Person { + # string first_name = 1; + # string last_name = 2; + # } + # + # { + # "@type": "type.googleapis.com/google.profile.Person", + # "firstName": , + # "lastName": + # } + # + # If the embedded message type is well-known and has a custom JSON + # representation, that representation will be embedded adding a field + # `value` which holds the custom JSON in addition to the `@type` + # field. Example (for message [google.protobuf.Duration][]): + # + # { + # "@type": "type.googleapis.com/google.protobuf.Duration", + # "value": "1.212s" + # } + # @!attribute [rw] type_url + # @return [::String] + # A URL/resource name that uniquely identifies the type of the serialized + # protocol buffer message. This string must contain at least + # one "/" character. The last segment of the URL's path must represent + # the fully qualified name of the type (as in + # `path/google.protobuf.Duration`). The name should be in a canonical form + # (e.g., leading "." is not accepted). + # + # In practice, teams usually precompile into the binary all types that they + # expect it to use in the context of Any. However, for URLs which use the + # scheme `http`, `https`, or no scheme, one can optionally set up a type + # server that maps type URLs to message definitions as follows: + # + # * If no scheme is provided, `https` is assumed. + # * An HTTP GET on the URL must yield a [google.protobuf.Type][] + # value in binary format, or produce an error. + # * Applications are allowed to cache lookup results based on the + # URL, or have them precompiled into a binary to avoid any + # lookup. Therefore, binary compatibility needs to be preserved + # on changes to types. (Use versioned type names to manage + # breaking changes.) + # + # Note: this functionality is not currently available in the official + # protobuf release, and it is not used for type URLs beginning with + # type.googleapis.com. As of May 2023, there are no widely used type server + # implementations and no plans to implement one. + # + # Schemes other than `http`, `https` (or the empty scheme) might be + # used with implementation specific semantics. + # @!attribute [rw] value + # @return [::String] + # Must be a valid serialized protocol buffer of the above specified type. + class Any + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..ea59f1f91daf --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..83e4481834a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A generic empty message that you can re-use to avoid defining duplicated + # empty messages in your APIs. A typical example is to use it as the request + # or the response type of an API method. For instance: + # + # service Foo { + # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + # } + class Empty + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..7f3ffc78601a --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..74352be9c58c --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch + # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + # 9999-12-31T23:59:59Z inclusive. + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. Negative + # second values with fractions must still have non-negative nanos values + # that count forward in time. Must be from 0 to 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb new file mode 100644 index 000000000000..c1a1c07eb2db --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Rpc + # The `Status` type defines a logical error model that is suitable for + # different programming environments, including REST APIs and RPC APIs. It is + # used by [gRPC](https://github.com/grpc). Each `Status` message contains + # three pieces of data: error code, error message, and error details. + # + # You can find out more about this error model and how to work with it in the + # [API Design Guide](https://cloud.google.com/apis/design/errors). + # @!attribute [rw] code + # @return [::Integer] + # The status code, which should be an enum value of + # [google.rpc.Code][google.rpc.Code]. + # @!attribute [rw] message + # @return [::String] + # A developer-facing error message, which should be in English. Any + # user-facing error message should be localized and sent in the + # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized + # by the client. + # @!attribute [rw] details + # @return [::Array<::Google::Protobuf::Any>] + # A list of messages that carry the error details. There is a common set of + # message types for APIs to use. + class Status + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile b/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile new file mode 100644 index 000000000000..bdff294d3cff --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-cloud-translate-v3", path: "../" +else + gem "google-cloud-translate-v3" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json b/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json new file mode 100644 index 000000000000..c234e2a00fb6 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json @@ -0,0 +1,1535 @@ +{ + "client_library": { + "name": "google-cloud-translate-v3", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.cloud.translation.v3", + "version": "v3" + } + ] + }, + "snippets": [ + { + "region_tag": "translate_v3_generated_TranslationService_TranslateText_sync", + "title": "Snippet for the translate_text call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_text.", + "file": "translation_service/translate_text.rb", + "language": "RUBY", + "client_method": { + "short_name": "translate_text", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#translate_text", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::TranslateTextRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::TranslateTextResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "TranslateText", + "full_name": "google.cloud.translation.v3.TranslationService.TranslateText", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_RomanizeText_sync", + "title": "Snippet for the romanize_text call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#romanize_text.", + "file": "translation_service/romanize_text.rb", + "language": "RUBY", + "client_method": { + "short_name": "romanize_text", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#romanize_text", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::RomanizeTextRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::RomanizeTextResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "RomanizeText", + "full_name": "google.cloud.translation.v3.TranslationService.RomanizeText", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DetectLanguage_sync", + "title": "Snippet for the detect_language call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#detect_language.", + "file": "translation_service/detect_language.rb", + "language": "RUBY", + "client_method": { + "short_name": "detect_language", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#detect_language", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DetectLanguageRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::DetectLanguageResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DetectLanguage", + "full_name": "google.cloud.translation.v3.TranslationService.DetectLanguage", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetSupportedLanguages_sync", + "title": "Snippet for the get_supported_languages call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages.", + "file": "translation_service/get_supported_languages.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_supported_languages", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::SupportedLanguages", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetSupportedLanguages", + "full_name": "google.cloud.translation.v3.TranslationService.GetSupportedLanguages", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_TranslateDocument_sync", + "title": "Snippet for the translate_document call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_document.", + "file": "translation_service/translate_document.rb", + "language": "RUBY", + "client_method": { + "short_name": "translate_document", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#translate_document", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::TranslateDocumentRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::TranslateDocumentResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "TranslateDocument", + "full_name": "google.cloud.translation.v3.TranslationService.TranslateDocument", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_BatchTranslateText_sync", + "title": "Snippet for the batch_translate_text call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text.", + "file": "translation_service/batch_translate_text.rb", + "language": "RUBY", + "client_method": { + "short_name": "batch_translate_text", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::BatchTranslateTextRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "BatchTranslateText", + "full_name": "google.cloud.translation.v3.TranslationService.BatchTranslateText", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_BatchTranslateDocument_sync", + "title": "Snippet for the batch_translate_document call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document.", + "file": "translation_service/batch_translate_document.rb", + "language": "RUBY", + "client_method": { + "short_name": "batch_translate_document", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "BatchTranslateDocument", + "full_name": "google.cloud.translation.v3.TranslationService.BatchTranslateDocument", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_CreateGlossary_sync", + "title": "Snippet for the create_glossary call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary.", + "file": "translation_service/create_glossary.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_glossary", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_glossary", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::CreateGlossaryRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "CreateGlossary", + "full_name": "google.cloud.translation.v3.TranslationService.CreateGlossary", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_UpdateGlossary_sync", + "title": "Snippet for the update_glossary call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#update_glossary.", + "file": "translation_service/update_glossary.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_glossary", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#update_glossary", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::UpdateGlossaryRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "UpdateGlossary", + "full_name": "google.cloud.translation.v3.TranslationService.UpdateGlossary", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListGlossaries_sync", + "title": "Snippet for the list_glossaries call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries.", + "file": "translation_service/list_glossaries.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_glossaries", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListGlossariesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListGlossariesResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListGlossaries", + "full_name": "google.cloud.translation.v3.TranslationService.ListGlossaries", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetGlossary_sync", + "title": "Snippet for the get_glossary call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary.", + "file": "translation_service/get_glossary.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_glossary", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_glossary", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetGlossaryRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::Glossary", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetGlossary", + "full_name": "google.cloud.translation.v3.TranslationService.GetGlossary", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteGlossary_sync", + "title": "Snippet for the delete_glossary call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary.", + "file": "translation_service/delete_glossary.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_glossary", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteGlossaryRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteGlossary", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteGlossary", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetGlossaryEntry_sync", + "title": "Snippet for the get_glossary_entry call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry.", + "file": "translation_service/get_glossary_entry.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_glossary_entry", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetGlossaryEntryRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetGlossaryEntry", + "full_name": "google.cloud.translation.v3.TranslationService.GetGlossaryEntry", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListGlossaryEntries_sync", + "title": "Snippet for the list_glossary_entries call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries.", + "file": "translation_service/list_glossary_entries.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_glossary_entries", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListGlossaryEntries", + "full_name": "google.cloud.translation.v3.TranslationService.ListGlossaryEntries", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_CreateGlossaryEntry_sync", + "title": "Snippet for the create_glossary_entry call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry.", + "file": "translation_service/create_glossary_entry.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_glossary_entry", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "CreateGlossaryEntry", + "full_name": "google.cloud.translation.v3.TranslationService.CreateGlossaryEntry", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync", + "title": "Snippet for the update_glossary_entry call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry.", + "file": "translation_service/update_glossary_entry.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_glossary_entry", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "UpdateGlossaryEntry", + "full_name": "google.cloud.translation.v3.TranslationService.UpdateGlossaryEntry", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync", + "title": "Snippet for the delete_glossary_entry call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry.", + "file": "translation_service/delete_glossary_entry.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_glossary_entry", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteGlossaryEntry", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteGlossaryEntry", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_CreateDataset_sync", + "title": "Snippet for the create_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_dataset.", + "file": "translation_service/create_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::CreateDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "CreateDataset", + "full_name": "google.cloud.translation.v3.TranslationService.CreateDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetDataset_sync", + "title": "Snippet for the get_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_dataset.", + "file": "translation_service/get_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::Dataset", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetDataset", + "full_name": "google.cloud.translation.v3.TranslationService.GetDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListDatasets_sync", + "title": "Snippet for the list_datasets call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_datasets.", + "file": "translation_service/list_datasets.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_datasets", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_datasets", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListDatasetsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListDatasetsResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListDatasets", + "full_name": "google.cloud.translation.v3.TranslationService.ListDatasets", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteDataset_sync", + "title": "Snippet for the delete_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset.", + "file": "translation_service/delete_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteDataset", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync", + "title": "Snippet for the create_adaptive_mt_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset.", + "file": "translation_service/create_adaptive_mt_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_adaptive_mt_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtDataset", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "CreateAdaptiveMtDataset", + "full_name": "google.cloud.translation.v3.TranslationService.CreateAdaptiveMtDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync", + "title": "Snippet for the delete_adaptive_mt_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset.", + "file": "translation_service/delete_adaptive_mt_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_adaptive_mt_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteAdaptiveMtDataset", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync", + "title": "Snippet for the get_adaptive_mt_dataset call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset.", + "file": "translation_service/get_adaptive_mt_dataset.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_adaptive_mt_dataset", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtDataset", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetAdaptiveMtDataset", + "full_name": "google.cloud.translation.v3.TranslationService.GetAdaptiveMtDataset", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync", + "title": "Snippet for the list_adaptive_mt_datasets call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets.", + "file": "translation_service/list_adaptive_mt_datasets.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_adaptive_mt_datasets", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListAdaptiveMtDatasets", + "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtDatasets", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync", + "title": "Snippet for the adaptive_mt_translate call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate.", + "file": "translation_service/adaptive_mt_translate.rb", + "language": "RUBY", + "client_method": { + "short_name": "adaptive_mt_translate", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "AdaptiveMtTranslate", + "full_name": "google.cloud.translation.v3.TranslationService.AdaptiveMtTranslate", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync", + "title": "Snippet for the get_adaptive_mt_file call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file.", + "file": "translation_service/get_adaptive_mt_file.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_adaptive_mt_file", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtFile", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetAdaptiveMtFile", + "full_name": "google.cloud.translation.v3.TranslationService.GetAdaptiveMtFile", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync", + "title": "Snippet for the delete_adaptive_mt_file call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file.", + "file": "translation_service/delete_adaptive_mt_file.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_adaptive_mt_file", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteAdaptiveMtFile", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtFile", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync", + "title": "Snippet for the import_adaptive_mt_file call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file.", + "file": "translation_service/import_adaptive_mt_file.rb", + "language": "RUBY", + "client_method": { + "short_name": "import_adaptive_mt_file", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ImportAdaptiveMtFile", + "full_name": "google.cloud.translation.v3.TranslationService.ImportAdaptiveMtFile", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync", + "title": "Snippet for the list_adaptive_mt_files call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files.", + "file": "translation_service/list_adaptive_mt_files.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_adaptive_mt_files", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListAdaptiveMtFiles", + "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtFiles", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync", + "title": "Snippet for the list_adaptive_mt_sentences call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences.", + "file": "translation_service/list_adaptive_mt_sentences.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_adaptive_mt_sentences", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListAdaptiveMtSentences", + "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtSentences", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ImportData_sync", + "title": "Snippet for the import_data call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_data.", + "file": "translation_service/import_data.rb", + "language": "RUBY", + "client_method": { + "short_name": "import_data", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#import_data", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ImportDataRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ImportData", + "full_name": "google.cloud.translation.v3.TranslationService.ImportData", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ExportData_sync", + "title": "Snippet for the export_data call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#export_data.", + "file": "translation_service/export_data.rb", + "language": "RUBY", + "client_method": { + "short_name": "export_data", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#export_data", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ExportDataRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ExportData", + "full_name": "google.cloud.translation.v3.TranslationService.ExportData", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListExamples_sync", + "title": "Snippet for the list_examples call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_examples.", + "file": "translation_service/list_examples.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_examples", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_examples", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListExamplesRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListExamplesResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListExamples", + "full_name": "google.cloud.translation.v3.TranslationService.ListExamples", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_CreateModel_sync", + "title": "Snippet for the create_model call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_model.", + "file": "translation_service/create_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_model", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::CreateModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "CreateModel", + "full_name": "google.cloud.translation.v3.TranslationService.CreateModel", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_ListModels_sync", + "title": "Snippet for the list_models call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_models.", + "file": "translation_service/list_models.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_models", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_models", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::ListModelsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::ListModelsResponse", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "ListModels", + "full_name": "google.cloud.translation.v3.TranslationService.ListModels", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_GetModel_sync", + "title": "Snippet for the get_model call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_model.", + "file": "translation_service/get_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_model", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::GetModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Translate::V3::Model", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "GetModel", + "full_name": "google.cloud.translation.v3.TranslationService.GetModel", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "translate_v3_generated_TranslationService_DeleteModel_sync", + "title": "Snippet for the delete_model call in the TranslationService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_model.", + "file": "translation_service/delete_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_model", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Translate::V3::DeleteModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "TranslationService::Client", + "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" + }, + "method": { + "short_name": "DeleteModel", + "full_name": "google.cloud.translation.v3.TranslationService.DeleteModel", + "service": { + "short_name": "TranslationService", + "full_name": "google.cloud.translation.v3.TranslationService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb new file mode 100644 index 000000000000..aa4ad9228411 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the adaptive_mt_translate call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate. +# +def adaptive_mt_translate + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new + + # Call the adaptive_mt_translate method. + result = client.adaptive_mt_translate request + + # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. + p result +end +# [END translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb new file mode 100644 index 000000000000..25d0fe3a2789 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_BatchTranslateDocument_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the batch_translate_document call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document. +# +def batch_translate_document + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new + + # Call the batch_translate_document method. + result = client.batch_translate_document request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb new file mode 100644 index 000000000000..1ed61588014c --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_BatchTranslateText_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the batch_translate_text call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text. +# +def batch_translate_text + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new + + # Call the batch_translate_text method. + result = client.batch_translate_text request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb new file mode 100644 index 000000000000..a7e3243384ec --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the create_adaptive_mt_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset. +# +def create_adaptive_mt_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new + + # Call the create_adaptive_mt_dataset method. + result = client.create_adaptive_mt_dataset request + + # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + p result +end +# [END translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb new file mode 100644 index 000000000000..0ae3a139cb62 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_CreateDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the create_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#create_dataset. +# +def create_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::CreateDatasetRequest.new + + # Call the create_dataset method. + result = client.create_dataset request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_CreateDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb new file mode 100644 index 000000000000..3ecab7c93861 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_CreateGlossary_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the create_glossary call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#create_glossary. +# +def create_glossary + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new + + # Call the create_glossary method. + result = client.create_glossary request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb new file mode 100644 index 000000000000..9f644113a2e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_CreateGlossaryEntry_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the create_glossary_entry call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry. +# +def create_glossary_entry + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new + + # Call the create_glossary_entry method. + result = client.create_glossary_entry request + + # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + p result +end +# [END translate_v3_generated_TranslationService_CreateGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb new file mode 100644 index 000000000000..f13607493059 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_CreateModel_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the create_model call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#create_model. +# +def create_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::CreateModelRequest.new + + # Call the create_model method. + result = client.create_model request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_CreateModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb new file mode 100644 index 000000000000..f9f940bb5044 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_adaptive_mt_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset. +# +def delete_adaptive_mt_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new + + # Call the delete_adaptive_mt_dataset method. + result = client.delete_adaptive_mt_dataset request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb new file mode 100644 index 000000000000..469a91f67799 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_adaptive_mt_file call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file. +# +def delete_adaptive_mt_file + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new + + # Call the delete_adaptive_mt_file method. + result = client.delete_adaptive_mt_file request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb new file mode 100644 index 000000000000..36188a743141 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset. +# +def delete_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new + + # Call the delete_dataset method. + result = client.delete_dataset request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_DeleteDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb new file mode 100644 index 000000000000..0d5258e5b7f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteGlossary_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_glossary call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary. +# +def delete_glossary + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new + + # Call the delete_glossary method. + result = client.delete_glossary request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb new file mode 100644 index 000000000000..f9a3a195e7df --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_glossary_entry call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry. +# +def delete_glossary_entry + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new + + # Call the delete_glossary_entry method. + result = client.delete_glossary_entry request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb new file mode 100644 index 000000000000..f97403f97994 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DeleteModel_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the delete_model call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#delete_model. +# +def delete_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DeleteModelRequest.new + + # Call the delete_model method. + result = client.delete_model request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_DeleteModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb new file mode 100644 index 000000000000..55ecd2e01e60 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_DetectLanguage_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the detect_language call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#detect_language. +# +def detect_language + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::DetectLanguageRequest.new + + # Call the detect_language method. + result = client.detect_language request + + # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. + p result +end +# [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb new file mode 100644 index 000000000000..67e09245adad --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ExportData_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the export_data call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#export_data. +# +def export_data + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ExportDataRequest.new + + # Call the export_data method. + result = client.export_data request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_ExportData_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb new file mode 100644 index 000000000000..ba4e677c2358 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_adaptive_mt_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset. +# +def get_adaptive_mt_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new + + # Call the get_adaptive_mt_dataset method. + result = client.get_adaptive_mt_dataset request + + # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. + p result +end +# [END translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb new file mode 100644 index 000000000000..0e7ebc6cc6ec --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_adaptive_mt_file call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file. +# +def get_adaptive_mt_file + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new + + # Call the get_adaptive_mt_file method. + result = client.get_adaptive_mt_file request + + # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. + p result +end +# [END translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb new file mode 100644 index 000000000000..3c560b5a9f1f --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetDataset_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_dataset call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_dataset. +# +def get_dataset + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetDatasetRequest.new + + # Call the get_dataset method. + result = client.get_dataset request + + # The returned object is of type Google::Cloud::Translate::V3::Dataset. + p result +end +# [END translate_v3_generated_TranslationService_GetDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb new file mode 100644 index 000000000000..b4d2ade127f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetGlossary_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_glossary call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_glossary. +# +def get_glossary + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetGlossaryRequest.new + + # Call the get_glossary method. + result = client.get_glossary request + + # The returned object is of type Google::Cloud::Translate::V3::Glossary. + p result +end +# [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb new file mode 100644 index 000000000000..422026b30132 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetGlossaryEntry_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_glossary_entry call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry. +# +def get_glossary_entry + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new + + # Call the get_glossary_entry method. + result = client.get_glossary_entry request + + # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + p result +end +# [END translate_v3_generated_TranslationService_GetGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb new file mode 100644 index 000000000000..c7ddbabd9b88 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetModel_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_model call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_model. +# +def get_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetModelRequest.new + + # Call the get_model method. + result = client.get_model request + + # The returned object is of type Google::Cloud::Translate::V3::Model. + p result +end +# [END translate_v3_generated_TranslationService_GetModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb new file mode 100644 index 000000000000..3ee79de1a1de --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_GetSupportedLanguages_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the get_supported_languages call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages. +# +def get_supported_languages + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new + + # Call the get_supported_languages method. + result = client.get_supported_languages request + + # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. + p result +end +# [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb new file mode 100644 index 000000000000..e44c710d2853 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the import_adaptive_mt_file call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file. +# +def import_adaptive_mt_file + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new + + # Call the import_adaptive_mt_file method. + result = client.import_adaptive_mt_file request + + # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. + p result +end +# [END translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb new file mode 100644 index 000000000000..5b13e7a3f486 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ImportData_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the import_data call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#import_data. +# +def import_data + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ImportDataRequest.new + + # Call the import_data method. + result = client.import_data request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_ImportData_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb new file mode 100644 index 000000000000..177ce32c2628 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_adaptive_mt_datasets call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets. +# +def list_adaptive_mt_datasets + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new + + # Call the list_adaptive_mt_datasets method. + result = client.list_adaptive_mt_datasets request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. + p item + end +end +# [END translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb new file mode 100644 index 000000000000..29e1435d5606 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_adaptive_mt_files call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files. +# +def list_adaptive_mt_files + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new + + # Call the list_adaptive_mt_files method. + result = client.list_adaptive_mt_files request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. + p item + end +end +# [END translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb new file mode 100644 index 000000000000..eac68d950a17 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_adaptive_mt_sentences call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences. +# +def list_adaptive_mt_sentences + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new + + # Call the list_adaptive_mt_sentences method. + result = client.list_adaptive_mt_sentences request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. + p item + end +end +# [END translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb new file mode 100644 index 000000000000..5e51cd9506fe --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListDatasets_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_datasets call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_datasets. +# +def list_datasets + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListDatasetsRequest.new + + # Call the list_datasets method. + result = client.list_datasets request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::Dataset. + p item + end +end +# [END translate_v3_generated_TranslationService_ListDatasets_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb new file mode 100644 index 000000000000..43332205b3b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListExamples_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_examples call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_examples. +# +def list_examples + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListExamplesRequest.new + + # Call the list_examples method. + result = client.list_examples request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::Example. + p item + end +end +# [END translate_v3_generated_TranslationService_ListExamples_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb new file mode 100644 index 000000000000..74b3307718fb --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListGlossaries_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_glossaries call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries. +# +def list_glossaries + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListGlossariesRequest.new + + # Call the list_glossaries method. + result = client.list_glossaries request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::Glossary. + p item + end +end +# [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb new file mode 100644 index 000000000000..f79260b875bb --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListGlossaryEntries_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_glossary_entries call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries. +# +def list_glossary_entries + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new + + # Call the list_glossary_entries method. + result = client.list_glossary_entries request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. + p item + end +end +# [END translate_v3_generated_TranslationService_ListGlossaryEntries_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb new file mode 100644 index 000000000000..50a7a989b9ac --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_ListModels_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the list_models call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#list_models. +# +def list_models + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::ListModelsRequest.new + + # Call the list_models method. + result = client.list_models request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Translate::V3::Model. + p item + end +end +# [END translate_v3_generated_TranslationService_ListModels_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb new file mode 100644 index 000000000000..83a2d907ca73 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_RomanizeText_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the romanize_text call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#romanize_text. +# +def romanize_text + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::RomanizeTextRequest.new + + # Call the romanize_text method. + result = client.romanize_text request + + # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. + p result +end +# [END translate_v3_generated_TranslationService_RomanizeText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb new file mode 100644 index 000000000000..bb4283c41aa1 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_TranslateDocument_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the translate_document call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#translate_document. +# +def translate_document + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new + + # Call the translate_document method. + result = client.translate_document request + + # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. + p result +end +# [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb new file mode 100644 index 000000000000..78c5e7b91c60 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_TranslateText_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the translate_text call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#translate_text. +# +def translate_text + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::TranslateTextRequest.new + + # Call the translate_text method. + result = client.translate_text request + + # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. + p result +end +# [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb new file mode 100644 index 000000000000..fd1baaf19c5a --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_UpdateGlossary_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the update_glossary call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#update_glossary. +# +def update_glossary + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new + + # Call the update_glossary method. + result = client.update_glossary request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END translate_v3_generated_TranslationService_UpdateGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb new file mode 100644 index 000000000000..8ba803b74149 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync] +require "google/cloud/translate/v3" + +## +# Snippet for the update_glossary_entry call in the TranslationService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry. +# +def update_glossary_entry + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Translate::V3::TranslationService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new + + # Call the update_glossary_entry method. + result = client.update_glossary_entry request + + # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. + p result +end +# [END translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb new file mode 100644 index 000000000000..6095a4a5cd3c --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/translate/v3/translation_service_pb" +require "google/cloud/translate/v3/translation_service_services_pb" +require "google/cloud/translate/v3/translation_service" + +class ::Google::Cloud::Translate::V3::TranslationService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb new file mode 100644 index 000000000000..9f8a19eacf25 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb @@ -0,0 +1,127 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/translate/v3/translation_service" + +class ::Google::Cloud::Translate::V3::TranslationService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_adaptive_mt_dataset_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.adaptive_mt_dataset_path project: "value0", location: "value1", dataset: "value2" + assert_equal "projects/value0/locations/value1/adaptiveMtDatasets/value2", path + end + end + + def test_adaptive_mt_file_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.adaptive_mt_file_path project: "value0", location: "value1", dataset: "value2", file: "value3" + assert_equal "projects/value0/locations/value1/adaptiveMtDatasets/value2/adaptiveMtFiles/value3", path + end + end + + def test_dataset_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.dataset_path project: "value0", location: "value1", dataset: "value2" + assert_equal "projects/value0/locations/value1/datasets/value2", path + end + end + + def test_glossary_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.glossary_path project: "value0", location: "value1", glossary: "value2" + assert_equal "projects/value0/locations/value1/glossaries/value2", path + end + end + + def test_glossary_entry_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.glossary_entry_path project: "value0", location: "value1", glossary: "value2", glossary_entry: "value3" + assert_equal "projects/value0/locations/value1/glossaries/value2/glossaryEntries/value3", path + end + end + + def test_location_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.location_path project: "value0", location: "value1" + assert_equal "projects/value0/locations/value1", path + end + end + + def test_model_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.model_path project: "value0", location: "value1", model: "value2" + assert_equal "projects/value0/locations/value1/models/value2", path + end + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb new file mode 100644 index 000000000000..4a0c75350056 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb @@ -0,0 +1,2229 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/translate/v3/translation_service_pb" +require "google/cloud/translate/v3/translation_service/rest" + + +class ::Google::Cloud::Translate::V3::TranslationService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_translate_text + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::TranslateTextResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + contents = ["hello world"] + mime_type = "hello world" + source_language_code = "hello world" + target_language_code = "hello world" + parent = "hello world" + model = "hello world" + glossary_config = {} + transliteration_config = {} + labels = {} + + translate_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_translate_text_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, translate_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.translate_text contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.translate_text ::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.translate_text(::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, translate_text_client_stub.call_count + end + end + end + + def test_romanize_text + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::RomanizeTextResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + contents = ["hello world"] + source_language_code = "hello world" + + romanize_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_romanize_text_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, romanize_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.romanize_text parent: parent, contents: contents, source_language_code: source_language_code do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.romanize_text ::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.romanize_text(::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, romanize_text_client_stub.call_count + end + end + end + + def test_detect_language + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::DetectLanguageResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = "hello world" + content = "hello world" + mime_type = "hello world" + labels = {} + + detect_language_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_detect_language_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, detect_language_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.detect_language parent: parent, model: model, content: content, mime_type: mime_type, labels: labels do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.detect_language ::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.detect_language(::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, detect_language_client_stub.call_count + end + end + end + + def test_get_supported_languages + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::SupportedLanguages.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + display_language_code = "hello world" + model = "hello world" + + get_supported_languages_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_supported_languages_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_supported_languages_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_supported_languages parent: parent, display_language_code: display_language_code, model: model do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_supported_languages ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_supported_languages(::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_supported_languages_client_stub.call_count + end + end + end + + def test_translate_document + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_code = "hello world" + document_input_config = {} + document_output_config = {} + model = "hello world" + glossary_config = {} + labels = {} + customized_attribution = "hello world" + is_translate_native_pdf_only = true + enable_shadow_removal_native_pdf = true + enable_rotation_correction = true + + translate_document_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_translate_document_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, translate_document_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.translate_document parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.translate_document ::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.translate_document(::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, translate_document_client_stub.call_count + end + end + end + + def test_batch_translate_text + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_codes = ["hello world"] + models = {} + input_configs = [{}] + output_config = {} + glossaries = {} + labels = {} + + batch_translate_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_batch_translate_text_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, batch_translate_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.batch_translate_text parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.batch_translate_text ::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.batch_translate_text(::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, batch_translate_text_client_stub.call_count + end + end + end + + def test_batch_translate_document + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_codes = ["hello world"] + input_configs = [{}] + output_config = {} + models = {} + glossaries = {} + format_conversions = {} + customized_attribution = "hello world" + enable_shadow_removal_native_pdf = true + enable_rotation_correction = true + + batch_translate_document_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_batch_translate_document_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, batch_translate_document_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.batch_translate_document parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.batch_translate_document ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.batch_translate_document(::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, batch_translate_document_client_stub.call_count + end + end + end + + def test_create_glossary + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + glossary = {} + + create_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_glossary_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_glossary({ parent: parent, glossary: glossary }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_glossary parent: parent, glossary: glossary do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_glossary ::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_glossary({ parent: parent, glossary: glossary }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_glossary(::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_glossary_client_stub.call_count + end + end + end + + def test_update_glossary + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + glossary = {} + update_mask = {} + + update_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_update_glossary_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_glossary({ glossary: glossary, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_glossary glossary: glossary, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_glossary ::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_glossary({ glossary: glossary, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_glossary(::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_glossary_client_stub.call_count + end + end + end + + def test_list_glossaries + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListGlossariesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_glossaries_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_glossaries_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_glossaries_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_glossaries parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_glossaries ::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_glossaries(::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_glossaries_client_stub.call_count + end + end + end + + def test_get_glossary + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::Glossary.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_glossary_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_glossary({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_glossary name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_glossary ::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_glossary({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_glossary(::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_glossary_client_stub.call_count + end + end + end + + def test_delete_glossary + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_glossary_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_glossary({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_glossary name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_glossary ::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_glossary({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_glossary(::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_glossary_client_stub.call_count + end + end + end + + def test_get_glossary_entry + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_glossary_entry_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_glossary_entry({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_glossary_entry name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_glossary_entry ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_glossary_entry({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_glossary_entry(::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_glossary_entry_client_stub.call_count + end + end + end + + def test_list_glossary_entries + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_glossary_entries_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_glossary_entries_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_glossary_entries_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_glossary_entries parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_glossary_entries ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_glossary_entries(::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_glossary_entries_client_stub.call_count + end + end + end + + def test_create_glossary_entry + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + glossary_entry = {} + + create_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_glossary_entry_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_glossary_entry parent: parent, glossary_entry: glossary_entry do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_glossary_entry ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_glossary_entry(::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_glossary_entry_client_stub.call_count + end + end + end + + def test_update_glossary_entry + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + glossary_entry = {} + + update_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_update_glossary_entry_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.update_glossary_entry({ glossary_entry: glossary_entry }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.update_glossary_entry glossary_entry: glossary_entry do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.update_glossary_entry ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.update_glossary_entry({ glossary_entry: glossary_entry }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.update_glossary_entry(::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_glossary_entry_client_stub.call_count + end + end + end + + def test_delete_glossary_entry + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_glossary_entry_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_glossary_entry({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_glossary_entry name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_glossary_entry ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_glossary_entry({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_glossary_entry(::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_glossary_entry_client_stub.call_count + end + end + end + + def test_create_dataset + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + dataset = {} + + create_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_dataset({ parent: parent, dataset: dataset }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_dataset parent: parent, dataset: dataset do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_dataset ::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_dataset({ parent: parent, dataset: dataset }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_dataset(::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_dataset_client_stub.call_count + end + end + end + + def test_get_dataset + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::Dataset.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_dataset({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_dataset name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_dataset ::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_dataset({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_dataset(::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_dataset_client_stub.call_count + end + end + end + + def test_list_datasets + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListDatasetsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_datasets_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_datasets_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_datasets_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_datasets parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_datasets ::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_datasets(::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_datasets_client_stub.call_count + end + end + end + + def test_delete_dataset + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_dataset({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_dataset name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_dataset ::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_dataset({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_dataset(::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_dataset_client_stub.call_count + end + end + end + + def test_create_adaptive_mt_dataset + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + adaptive_mt_dataset = {} + + create_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_adaptive_mt_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_adaptive_mt_dataset parent: parent, adaptive_mt_dataset: adaptive_mt_dataset do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_adaptive_mt_dataset ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_adaptive_mt_dataset(::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_adaptive_mt_dataset_client_stub.call_count + end + end + end + + def test_delete_adaptive_mt_dataset + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_adaptive_mt_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_adaptive_mt_dataset({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_adaptive_mt_dataset name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_adaptive_mt_dataset ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_adaptive_mt_dataset({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_adaptive_mt_dataset(::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_adaptive_mt_dataset_client_stub.call_count + end + end + end + + def test_get_adaptive_mt_dataset + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_adaptive_mt_dataset_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_adaptive_mt_dataset({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_adaptive_mt_dataset name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_adaptive_mt_dataset ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_adaptive_mt_dataset({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_adaptive_mt_dataset(::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_adaptive_mt_dataset_client_stub.call_count + end + end + end + + def test_list_adaptive_mt_datasets + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_adaptive_mt_datasets_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_datasets_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_datasets_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_adaptive_mt_datasets parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_adaptive_mt_datasets ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_adaptive_mt_datasets(::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_datasets_client_stub.call_count + end + end + end + + def test_adaptive_mt_translate + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + dataset = "hello world" + content = ["hello world"] + mime_type = "hello world" + reference_sentence_config = {} + glossary_config = {} + + adaptive_mt_translate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_adaptive_mt_translate_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, adaptive_mt_translate_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, adaptive_mt_translate_client_stub.call_count + end + end + end + + def test_get_adaptive_mt_file + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::AdaptiveMtFile.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_adaptive_mt_file_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_adaptive_mt_file({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_adaptive_mt_file name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_adaptive_mt_file ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_adaptive_mt_file({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_adaptive_mt_file(::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_adaptive_mt_file_client_stub.call_count + end + end + end + + def test_delete_adaptive_mt_file + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_adaptive_mt_file_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_adaptive_mt_file({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_adaptive_mt_file name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_adaptive_mt_file ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_adaptive_mt_file({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_adaptive_mt_file(::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_adaptive_mt_file_client_stub.call_count + end + end + end + + def test_import_adaptive_mt_file + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + file_input_source = {} + + import_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_import_adaptive_mt_file_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.import_adaptive_mt_file parent: parent, file_input_source: file_input_source do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.import_adaptive_mt_file ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.import_adaptive_mt_file(::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_adaptive_mt_file_client_stub.call_count + end + end + end + + def test_list_adaptive_mt_files + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_adaptive_mt_files_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_files_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_files_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_adaptive_mt_files parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_adaptive_mt_files ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_adaptive_mt_files(::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_files_client_stub.call_count + end + end + end + + def test_list_adaptive_mt_sentences + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_adaptive_mt_sentences_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_sentences_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_sentences_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_adaptive_mt_sentences parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_adaptive_mt_sentences ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_adaptive_mt_sentences(::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_sentences_client_stub.call_count + end + end + end + + def test_import_data + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + dataset = "hello world" + input_config = {} + + import_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_import_data_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_data_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.import_data({ dataset: dataset, input_config: input_config }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.import_data dataset: dataset, input_config: input_config do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.import_data ::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.import_data({ dataset: dataset, input_config: input_config }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.import_data(::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_data_client_stub.call_count + end + end + end + + def test_export_data + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + dataset = "hello world" + output_config = {} + + export_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_export_data_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, export_data_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.export_data({ dataset: dataset, output_config: output_config }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.export_data dataset: dataset, output_config: output_config do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.export_data ::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.export_data({ dataset: dataset, output_config: output_config }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.export_data(::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, export_data_client_stub.call_count + end + end + end + + def test_list_examples + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListExamplesResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + + list_examples_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_examples_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_examples_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_examples parent: parent, filter: filter, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_examples ::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_examples(::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_examples_client_stub.call_count + end + end + end + + def test_create_model + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = {} + + create_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.create_model({ parent: parent, model: model }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.create_model parent: parent, model: model do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.create_model ::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.create_model({ parent: parent, model: model }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.create_model(::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_model_client_stub.call_count + end + end + end + + def test_list_models + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::ListModelsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + + list_models_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_models_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_models_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_models parent: parent, filter: filter, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_models ::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_models(::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_models_client_stub.call_count + end + end + end + + def test_get_model + # Create test objects. + client_result = ::Google::Cloud::Translate::V3::Model.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_model ::Google::Cloud::Translate::V3::GetModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_model(::Google::Cloud::Translate::V3::GetModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_model_client_stub.call_count + end + end + end + + def test_delete_model + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_model ::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_model(::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_model_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb new file mode 100644 index 000000000000..f7ed81b66174 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb @@ -0,0 +1,2577 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/translate/v3/translation_service_pb" +require "google/cloud/translate/v3/translation_service" + +class ::Google::Cloud::Translate::V3::TranslationService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_translate_text + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::TranslateTextResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + contents = ["hello world"] + mime_type = "hello world" + source_language_code = "hello world" + target_language_code = "hello world" + parent = "hello world" + model = "hello world" + glossary_config = {} + transliteration_config = {} + labels = {} + + translate_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :translate_text, name + assert_kind_of ::Google::Cloud::Translate::V3::TranslateTextRequest, request + assert_equal ["hello world"], request["contents"] + assert_equal "hello world", request["mime_type"] + assert_equal "hello world", request["source_language_code"] + assert_equal "hello world", request["target_language_code"] + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["model"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig), request["glossary_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TransliterationConfig), request["transliteration_config"] + assert_equal({}, request["labels"].to_h) + refute_nil options + end + + Gapic::ServiceStub.stub :new, translate_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.translate_text contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.translate_text ::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.translate_text(::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, translate_text_client_stub.call_rpc_count + end + end + + def test_romanize_text + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::RomanizeTextResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + contents = ["hello world"] + source_language_code = "hello world" + + romanize_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :romanize_text, name + assert_kind_of ::Google::Cloud::Translate::V3::RomanizeTextRequest, request + assert_equal "hello world", request["parent"] + assert_equal ["hello world"], request["contents"] + assert_equal "hello world", request["source_language_code"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, romanize_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.romanize_text parent: parent, contents: contents, source_language_code: source_language_code do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.romanize_text ::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.romanize_text(::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, romanize_text_client_stub.call_rpc_count + end + end + + def test_detect_language + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::DetectLanguageResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = "hello world" + content = "hello world" + mime_type = "hello world" + labels = {} + + detect_language_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :detect_language, name + assert_kind_of ::Google::Cloud::Translate::V3::DetectLanguageRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["model"] + assert_equal "hello world", request["content"] + assert_equal :content, request.source + assert_equal "hello world", request["mime_type"] + assert_equal({}, request["labels"].to_h) + refute_nil options + end + + Gapic::ServiceStub.stub :new, detect_language_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.detect_language parent: parent, model: model, content: content, mime_type: mime_type, labels: labels do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.detect_language ::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.detect_language(::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, detect_language_client_stub.call_rpc_count + end + end + + def test_get_supported_languages + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::SupportedLanguages.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + display_language_code = "hello world" + model = "hello world" + + get_supported_languages_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_supported_languages, name + assert_kind_of ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["display_language_code"] + assert_equal "hello world", request["model"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_supported_languages_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_supported_languages parent: parent, display_language_code: display_language_code, model: model do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_supported_languages ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_supported_languages(::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_supported_languages_client_stub.call_rpc_count + end + end + + def test_translate_document + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_code = "hello world" + document_input_config = {} + document_output_config = {} + model = "hello world" + glossary_config = {} + labels = {} + customized_attribution = "hello world" + is_translate_native_pdf_only = true + enable_shadow_removal_native_pdf = true + enable_rotation_correction = true + + translate_document_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :translate_document, name + assert_kind_of ::Google::Cloud::Translate::V3::TranslateDocumentRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["source_language_code"] + assert_equal "hello world", request["target_language_code"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DocumentInputConfig), request["document_input_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DocumentOutputConfig), request["document_output_config"] + assert_equal "hello world", request["model"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig), request["glossary_config"] + assert_equal({}, request["labels"].to_h) + assert_equal "hello world", request["customized_attribution"] + assert_equal true, request["is_translate_native_pdf_only"] + assert_equal true, request["enable_shadow_removal_native_pdf"] + assert_equal true, request["enable_rotation_correction"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, translate_document_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.translate_document parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.translate_document ::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.translate_document(::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, translate_document_client_stub.call_rpc_count + end + end + + def test_batch_translate_text + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_codes = ["hello world"] + models = {} + input_configs = [{}] + output_config = {} + glossaries = {} + labels = {} + + batch_translate_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :batch_translate_text, name + assert_kind_of ::Google::Cloud::Translate::V3::BatchTranslateTextRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["source_language_code"] + assert_equal ["hello world"], request["target_language_codes"] + assert_equal({}, request["models"].to_h) + assert_kind_of ::Google::Cloud::Translate::V3::InputConfig, request["input_configs"].first + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::OutputConfig), request["output_config"] + assert_equal({}, request["glossaries"].to_h) + assert_equal({}, request["labels"].to_h) + refute_nil options + end + + Gapic::ServiceStub.stub :new, batch_translate_text_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.batch_translate_text parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.batch_translate_text ::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.batch_translate_text(::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, batch_translate_text_client_stub.call_rpc_count + end + end + + def test_batch_translate_document + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + source_language_code = "hello world" + target_language_codes = ["hello world"] + input_configs = [{}] + output_config = {} + models = {} + glossaries = {} + format_conversions = {} + customized_attribution = "hello world" + enable_shadow_removal_native_pdf = true + enable_rotation_correction = true + + batch_translate_document_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :batch_translate_document, name + assert_kind_of ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["source_language_code"] + assert_equal ["hello world"], request["target_language_codes"] + assert_kind_of ::Google::Cloud::Translate::V3::BatchDocumentInputConfig, request["input_configs"].first + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::BatchDocumentOutputConfig), request["output_config"] + assert_equal({}, request["models"].to_h) + assert_equal({}, request["glossaries"].to_h) + assert_equal({}, request["format_conversions"].to_h) + assert_equal "hello world", request["customized_attribution"] + assert_equal true, request["enable_shadow_removal_native_pdf"] + assert_equal true, request["enable_rotation_correction"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, batch_translate_document_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.batch_translate_document parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.batch_translate_document ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.batch_translate_document(::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, batch_translate_document_client_stub.call_rpc_count + end + end + + def test_create_glossary + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + glossary = {} + + create_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_glossary, name + assert_kind_of ::Google::Cloud::Translate::V3::CreateGlossaryRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Glossary), request["glossary"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_glossary({ parent: parent, glossary: glossary }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_glossary parent: parent, glossary: glossary do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_glossary ::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_glossary({ parent: parent, glossary: glossary }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_glossary(::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_glossary_client_stub.call_rpc_count + end + end + + def test_update_glossary + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + glossary = {} + update_mask = {} + + update_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_glossary, name + assert_kind_of ::Google::Cloud::Translate::V3::UpdateGlossaryRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Glossary), request["glossary"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_glossary({ glossary: glossary, update_mask: update_mask }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_glossary glossary: glossary, update_mask: update_mask do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_glossary ::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_glossary({ glossary: glossary, update_mask: update_mask }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_glossary(::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_glossary_client_stub.call_rpc_count + end + end + + def test_list_glossaries + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListGlossariesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_glossaries_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_glossaries, name + assert_kind_of ::Google::Cloud::Translate::V3::ListGlossariesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_glossaries_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_glossaries parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_glossaries ::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_glossaries(::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_glossaries_client_stub.call_rpc_count + end + end + + def test_get_glossary + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::Glossary.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_glossary, name + assert_kind_of ::Google::Cloud::Translate::V3::GetGlossaryRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_glossary({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_glossary name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_glossary ::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_glossary({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_glossary(::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_glossary_client_stub.call_rpc_count + end + end + + def test_delete_glossary + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_glossary, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteGlossaryRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_glossary_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_glossary({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_glossary name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_glossary ::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_glossary({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_glossary(::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_glossary_client_stub.call_rpc_count + end + end + + def test_get_glossary_entry + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_glossary_entry, name + assert_kind_of ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_glossary_entry({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_glossary_entry name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_glossary_entry ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_glossary_entry({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_glossary_entry(::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_glossary_entry_client_stub.call_rpc_count + end + end + + def test_list_glossary_entries + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_glossary_entries_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_glossary_entries, name + assert_kind_of ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_glossary_entries_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_glossary_entries parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_glossary_entries ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_glossary_entries(::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_glossary_entries_client_stub.call_rpc_count + end + end + + def test_create_glossary_entry + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + glossary_entry = {} + + create_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_glossary_entry, name + assert_kind_of ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::GlossaryEntry), request["glossary_entry"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_glossary_entry parent: parent, glossary_entry: glossary_entry do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_glossary_entry ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_glossary_entry(::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_glossary_entry_client_stub.call_rpc_count + end + end + + def test_update_glossary_entry + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + glossary_entry = {} + + update_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_glossary_entry, name + assert_kind_of ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::GlossaryEntry), request["glossary_entry"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.update_glossary_entry({ glossary_entry: glossary_entry }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.update_glossary_entry glossary_entry: glossary_entry do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.update_glossary_entry ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.update_glossary_entry({ glossary_entry: glossary_entry }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.update_glossary_entry(::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_glossary_entry_client_stub.call_rpc_count + end + end + + def test_delete_glossary_entry + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_glossary_entry, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_glossary_entry_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_glossary_entry({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_glossary_entry name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_glossary_entry ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_glossary_entry({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_glossary_entry(::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_glossary_entry_client_stub.call_rpc_count + end + end + + def test_create_dataset + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + dataset = {} + + create_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::CreateDatasetRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Dataset), request["dataset"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_dataset({ parent: parent, dataset: dataset }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_dataset parent: parent, dataset: dataset do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_dataset ::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_dataset({ parent: parent, dataset: dataset }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_dataset(::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_dataset_client_stub.call_rpc_count + end + end + + def test_get_dataset + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::Dataset.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::GetDatasetRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_dataset({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_dataset name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_dataset ::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_dataset({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_dataset(::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_dataset_client_stub.call_rpc_count + end + end + + def test_list_datasets + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListDatasetsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_datasets_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_datasets, name + assert_kind_of ::Google::Cloud::Translate::V3::ListDatasetsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_datasets_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_datasets parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_datasets ::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_datasets(::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_datasets_client_stub.call_rpc_count + end + end + + def test_delete_dataset + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteDatasetRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_dataset({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_dataset name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_dataset ::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_dataset({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_dataset(::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_dataset_client_stub.call_rpc_count + end + end + + def test_create_adaptive_mt_dataset + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + adaptive_mt_dataset = {} + + create_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_adaptive_mt_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtDataset), request["adaptive_mt_dataset"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_adaptive_mt_dataset parent: parent, adaptive_mt_dataset: adaptive_mt_dataset do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_adaptive_mt_dataset ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_adaptive_mt_dataset(::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_adaptive_mt_dataset_client_stub.call_rpc_count + end + end + + def test_delete_adaptive_mt_dataset + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_adaptive_mt_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_adaptive_mt_dataset({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_adaptive_mt_dataset name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_adaptive_mt_dataset ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_adaptive_mt_dataset({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_adaptive_mt_dataset(::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_adaptive_mt_dataset_client_stub.call_rpc_count + end + end + + def test_get_adaptive_mt_dataset + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_adaptive_mt_dataset, name + assert_kind_of ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_adaptive_mt_dataset_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_adaptive_mt_dataset({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_adaptive_mt_dataset name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_adaptive_mt_dataset ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_adaptive_mt_dataset({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_adaptive_mt_dataset(::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_adaptive_mt_dataset_client_stub.call_rpc_count + end + end + + def test_list_adaptive_mt_datasets + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_adaptive_mt_datasets_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_adaptive_mt_datasets, name + assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_adaptive_mt_datasets_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_adaptive_mt_datasets parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_adaptive_mt_datasets ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_adaptive_mt_datasets(::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_datasets_client_stub.call_rpc_count + end + end + + def test_adaptive_mt_translate + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + dataset = "hello world" + content = ["hello world"] + mime_type = "hello world" + reference_sentence_config = {} + glossary_config = {} + + adaptive_mt_translate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :adaptive_mt_translate, name + assert_kind_of ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["dataset"] + assert_equal ["hello world"], request["content"] + assert_equal "hello world", request["mime_type"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig), request["reference_sentence_config"] + assert request.has_reference_sentence_config? + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig), request["glossary_config"] + assert request.has_glossary_config? + refute_nil options + end + + Gapic::ServiceStub.stub :new, adaptive_mt_translate_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, adaptive_mt_translate_client_stub.call_rpc_count + end + end + + def test_get_adaptive_mt_file + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtFile.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_adaptive_mt_file, name + assert_kind_of ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_adaptive_mt_file({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_adaptive_mt_file name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_adaptive_mt_file ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_adaptive_mt_file({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_adaptive_mt_file(::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_adaptive_mt_file_client_stub.call_rpc_count + end + end + + def test_delete_adaptive_mt_file + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_adaptive_mt_file, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_adaptive_mt_file({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_adaptive_mt_file name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_adaptive_mt_file ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_adaptive_mt_file({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_adaptive_mt_file(::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_adaptive_mt_file_client_stub.call_rpc_count + end + end + + def test_import_adaptive_mt_file + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + file_input_source = {} + + import_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import_adaptive_mt_file, name + assert_kind_of ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::FileInputSource), request["file_input_source"] + assert_equal :file_input_source, request.source + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_adaptive_mt_file_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.import_adaptive_mt_file parent: parent, file_input_source: file_input_source do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.import_adaptive_mt_file ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.import_adaptive_mt_file(::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_adaptive_mt_file_client_stub.call_rpc_count + end + end + + def test_list_adaptive_mt_files + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_adaptive_mt_files_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_adaptive_mt_files, name + assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_adaptive_mt_files_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_adaptive_mt_files parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_adaptive_mt_files ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_adaptive_mt_files(::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_files_client_stub.call_rpc_count + end + end + + def test_list_adaptive_mt_sentences + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_adaptive_mt_sentences_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_adaptive_mt_sentences, name + assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_adaptive_mt_sentences_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_adaptive_mt_sentences parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_adaptive_mt_sentences ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_adaptive_mt_sentences(::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_adaptive_mt_sentences_client_stub.call_rpc_count + end + end + + def test_import_data + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + dataset = "hello world" + input_config = {} + + import_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import_data, name + assert_kind_of ::Google::Cloud::Translate::V3::ImportDataRequest, request + assert_equal "hello world", request["dataset"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DatasetInputConfig), request["input_config"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_data_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.import_data({ dataset: dataset, input_config: input_config }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.import_data dataset: dataset, input_config: input_config do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.import_data ::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.import_data({ dataset: dataset, input_config: input_config }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.import_data(::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_data_client_stub.call_rpc_count + end + end + + def test_export_data + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + dataset = "hello world" + output_config = {} + + export_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :export_data, name + assert_kind_of ::Google::Cloud::Translate::V3::ExportDataRequest, request + assert_equal "hello world", request["dataset"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DatasetOutputConfig), request["output_config"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, export_data_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.export_data({ dataset: dataset, output_config: output_config }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.export_data dataset: dataset, output_config: output_config do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.export_data ::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.export_data({ dataset: dataset, output_config: output_config }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.export_data(::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, export_data_client_stub.call_rpc_count + end + end + + def test_list_examples + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListExamplesResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + + list_examples_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_examples, name + assert_kind_of ::Google::Cloud::Translate::V3::ListExamplesRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_examples_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_examples parent: parent, filter: filter, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_examples ::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_examples(::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_examples_client_stub.call_rpc_count + end + end + + def test_create_model + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = {} + + create_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_model, name + assert_kind_of ::Google::Cloud::Translate::V3::CreateModelRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Model), request["model"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.create_model({ parent: parent, model: model }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.create_model parent: parent, model: model do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.create_model ::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.create_model({ parent: parent, model: model }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.create_model(::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_model_client_stub.call_rpc_count + end + end + + def test_list_models + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::ListModelsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + + list_models_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_models, name + assert_kind_of ::Google::Cloud::Translate::V3::ListModelsRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_models_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_models parent: parent, filter: filter, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_models ::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_models(::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_models_client_stub.call_rpc_count + end + end + + def test_get_model + # Create GRPC objects. + grpc_response = ::Google::Cloud::Translate::V3::Model.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_model, name + assert_kind_of ::Google::Cloud::Translate::V3::GetModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_model({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_model name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_model ::Google::Cloud::Translate::V3::GetModelRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_model({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_model(::Google::Cloud::Translate::V3::GetModelRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_model_client_stub.call_rpc_count + end + end + + def test_delete_model + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_model, name + assert_kind_of ::Google::Cloud::Translate::V3::DeleteModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_model_client_stub do + # Create client + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_model({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_model name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_model ::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_model({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_model(::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_model_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/helper.rb b/owl-bot-staging/google-cloud-translate-v3/test/helper.rb new file mode 100644 index 000000000000..672b337030e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-translate-v3/test/helper.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "minitest/autorun" +require "minitest/focus" +require "minitest/mock" +require "minitest/rg" + +require "grpc" + +require "ostruct" From 82902448a607a9b49606f3c656258d2d101b39fa Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 6 Apr 2026 21:02:11 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../cloud/translate/v3/adaptive_mt_pb.rb | 2 +- .../v3/translation_service/client.rb | 4 +- .../v3/translation_service/rest/client.rb | 4 +- .../proto_docs/google/api/client.rb | 178 +- .../google/cloud/translate/v3/adaptive_mt.rb | 3 + .../v3/translation_service_rest_test.rb | 11 +- .../translate/v3/translation_service_test.rb | 12 +- .../google-cloud-translate-v3/.gitignore | 22 - .../.repo-metadata.json | 18 - .../google-cloud-translate-v3/.rubocop.yml | 33 - .../google-cloud-translate-v3/.toys.rb | 28 - .../google-cloud-translate-v3/.yardopts | 12 - .../AUTHENTICATION.md | 122 - .../google-cloud-translate-v3/CHANGELOG.md | 2 - .../google-cloud-translate-v3/Gemfile | 14 - .../google-cloud-translate-v3/LICENSE.md | 201 - .../google-cloud-translate-v3/README.md | 154 - .../google-cloud-translate-v3/Rakefile | 169 - .../gapic_metadata.json | 208 - .../google-cloud-translate-v3.gemspec | 30 - .../lib/google-cloud-translate-v3.rb | 21 - .../lib/google/cloud/translate/v3.rb | 45 - .../cloud/translate/v3/adaptive_mt_pb.rb | 48 - .../translate/v3/automl_translation_pb.rb | 54 - .../cloud/translate/v3/bindings_override.rb | 75 - .../google/cloud/translate/v3/common_pb.rb | 31 - .../lib/google/cloud/translate/v3/rest.rb | 38 - .../cloud/translate/v3/translation_service.rb | 56 - .../v3/translation_service/client.rb | 4616 ----------------- .../v3/translation_service/credentials.rb | 52 - .../v3/translation_service/operations.rb | 849 --- .../translate/v3/translation_service/paths.rb | 168 - .../translate/v3/translation_service/rest.rb | 54 - .../v3/translation_service/rest/client.rb | 4315 --------------- .../v3/translation_service/rest/operations.rb | 1093 ---- .../translation_service/rest/service_stub.rb | 2454 --------- .../translate/v3/translation_service_pb.rb | 88 - .../v3/translation_service_services_pb.rb | 141 - .../lib/google/cloud/translate/v3/version.rb | 28 - .../proto_docs/README.md | 4 - .../proto_docs/google/api/client.rb | 593 --- .../proto_docs/google/api/field_behavior.rb | 85 - .../proto_docs/google/api/launch_stage.rb | 71 - .../proto_docs/google/api/resource.rb | 227 - .../google/cloud/translate/v3/adaptive_mt.rb | 408 -- .../cloud/translate/v3/automl_translation.rb | 487 -- .../google/cloud/translate/v3/common.rb | 143 - .../cloud/translate/v3/translation_service.rb | 1657 ------ .../google/longrunning/operations.rb | 191 - .../proto_docs/google/protobuf/any.rb | 145 - .../proto_docs/google/protobuf/duration.rb | 98 - .../proto_docs/google/protobuf/empty.rb | 34 - .../proto_docs/google/protobuf/field_mask.rb | 229 - .../proto_docs/google/protobuf/timestamp.rb | 127 - .../proto_docs/google/rpc/status.rb | 48 - .../snippets/Gemfile | 32 - ..._metadata_google.cloud.translation.v3.json | 1535 ------ .../adaptive_mt_translate.rb | 47 - .../batch_translate_document.rb | 54 - .../batch_translate_text.rb | 54 - .../create_adaptive_mt_dataset.rb | 47 - .../translation_service/create_dataset.rb | 54 - .../translation_service/create_glossary.rb | 54 - .../create_glossary_entry.rb | 47 - .../translation_service/create_model.rb | 54 - .../delete_adaptive_mt_dataset.rb | 47 - .../delete_adaptive_mt_file.rb | 47 - .../translation_service/delete_dataset.rb | 54 - .../translation_service/delete_glossary.rb | 54 - .../delete_glossary_entry.rb | 47 - .../translation_service/delete_model.rb | 54 - .../translation_service/detect_language.rb | 47 - .../translation_service/export_data.rb | 54 - .../get_adaptive_mt_dataset.rb | 47 - .../get_adaptive_mt_file.rb | 47 - .../translation_service/get_dataset.rb | 47 - .../translation_service/get_glossary.rb | 47 - .../translation_service/get_glossary_entry.rb | 47 - .../snippets/translation_service/get_model.rb | 47 - .../get_supported_languages.rb | 47 - .../import_adaptive_mt_file.rb | 47 - .../translation_service/import_data.rb | 54 - .../list_adaptive_mt_datasets.rb | 51 - .../list_adaptive_mt_files.rb | 51 - .../list_adaptive_mt_sentences.rb | 51 - .../translation_service/list_datasets.rb | 51 - .../translation_service/list_examples.rb | 51 - .../translation_service/list_glossaries.rb | 51 - .../list_glossary_entries.rb | 51 - .../translation_service/list_models.rb | 51 - .../translation_service/romanize_text.rb | 47 - .../translation_service/translate_document.rb | 47 - .../translation_service/translate_text.rb | 47 - .../translation_service/update_glossary.rb | 54 - .../update_glossary_entry.rb | 47 - .../v3/translation_service_operations_test.rb | 400 -- .../v3/translation_service_paths_test.rb | 127 - .../v3/translation_service_rest_test.rb | 2229 -------- .../translate/v3/translation_service_test.rb | 2577 --------- .../google-cloud-translate-v3/test/helper.rb | 26 - 100 files changed, 172 insertions(+), 28649 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-translate-v3/.gitignore delete mode 100644 owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json delete mode 100644 owl-bot-staging/google-cloud-translate-v3/.rubocop.yml delete mode 100644 owl-bot-staging/google-cloud-translate-v3/.toys.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/.yardopts delete mode 100644 owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md delete mode 100644 owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md delete mode 100644 owl-bot-staging/google-cloud-translate-v3/Gemfile delete mode 100644 owl-bot-staging/google-cloud-translate-v3/LICENSE.md delete mode 100644 owl-bot-staging/google-cloud-translate-v3/README.md delete mode 100644 owl-bot-staging/google-cloud-translate-v3/Rakefile delete mode 100644 owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-translate-v3/test/helper.rb diff --git a/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb index 0566c827303a..a65944af7001 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb @@ -10,7 +10,7 @@ require 'google/protobuf/timestamp_pb' -descriptor_data = "\n+google/cloud/translate/v3/adaptive_mt.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa1\x03\n\x11\x41\x64\x61ptiveMtDataset\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x15\n\rexample_count\x18\x05 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:u\xea\x41r\n*translate.googleapis.com/AdaptiveMtDataset\x12\x44projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}\"\xad\x01\n\x1e\x43reateAdaptiveMtDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12P\n\x13\x61\x64\x61ptive_mt_dataset\x18\x02 \x01(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x02\"b\n\x1e\x44\x65leteAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"_\n\x1bGetAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"\xa0\x01\n\x1dListAdaptiveMtDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"\x91\x01\n\x1eListAdaptiveMtDatasetsResponse\x12Q\n\x14\x61\x64\x61ptive_mt_datasets\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\x8b\x08\n\x1a\x41\x64\x61ptiveMtTranslateRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x43\n\x07\x64\x61taset\x18\x02 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x07\x63ontent\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12w\n\x19reference_sentence_config\x18\x06 \x01(\x0b\x32O.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfigH\x00\x88\x01\x01\x12i\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x46.google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfigB\x03\xe0\x41\x01H\x01\x88\x01\x01\x1aI\n\x15ReferenceSentencePair\x12\x17\n\x0fsource_sentence\x18\x01 \x01(\t\x12\x17\n\x0ftarget_sentence\x18\x02 \x01(\t\x1a\x8c\x01\n\x19ReferenceSentencePairList\x12o\n\x18reference_sentence_pairs\x18\x01 \x03(\x0b\x32M.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair\x1a\xcf\x01\n\x17ReferenceSentenceConfig\x12x\n\x1dreference_sentence_pair_lists\x18\x01 \x03(\x0b\x32Q.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList\x12\x1c\n\x14source_language_code\x18\x02 \x01(\t\x12\x1c\n\x14target_language_code\x18\x03 \x01(\t\x1a\x94\x01\n\x0eGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x42\x1c\n\x1a_reference_sentence_configB\x12\n\x10_glossary_config\"5\n\x15\x41\x64\x61ptiveMtTranslation\x12\x1c\n\x0ftranslated_text\x18\x01 \x01(\tB\x03\xe0\x41\x03\"\xdb\x01\n\x1b\x41\x64\x61ptiveMtTranslateResponse\x12M\n\x0ctranslations\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslationB\x03\xe0\x41\x03\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12Q\n\x15glossary_translations\x18\x04 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslation\"\x94\x03\n\x0e\x41\x64\x61ptiveMtFile\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xab\x01\xea\x41\xa7\x01\n\'translate.googleapis.com/AdaptiveMtFile\x12[projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}*\x0f\x61\x64\x61ptiveMtFiles2\x0e\x61\x64\x61ptiveMtFile\"Y\n\x18GetAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\\\n\x1b\x44\x65leteAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\xff\x01\n\x1bImportAdaptiveMtFileRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12I\n\x11\x66ile_input_source\x18\x02 \x01(\x0b\x32,.google.cloud.translation.v3.FileInputSourceH\x00\x12G\n\x10gcs_input_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"j\n\x1cImportAdaptiveMtFileResponse\x12J\n\x10\x61\x64\x61ptive_mt_file\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\"\x91\x01\n\x1aListAdaptiveMtFilesRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x88\x01\n\x1bListAdaptiveMtFilesResponse\x12K\n\x11\x61\x64\x61ptive_mt_files\x18\x01 \x03(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\xd8\x03\n\x12\x41\x64\x61ptiveMtSentence\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+translate.googleapis.com/AdaptiveMtSentence\x12\x1c\n\x0fsource_sentence\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftarget_sentence\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xd6\x01\xea\x41\xd2\x01\n+translate.googleapis.com/AdaptiveMtSentence\x12zprojects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}*\x13\x61\x64\x61ptiveMtSentences2\x12\x61\x64\x61ptiveMtSentence\"\x88\x01\n\x1eListAdaptiveMtSentencesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x94\x01\n\x1fListAdaptiveMtSentencesResponse\x12S\n\x15\x61\x64\x61ptive_mt_sentences\x18\x01 \x03(\x0b\x32/.google.cloud.translation.v3.AdaptiveMtSentenceB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\x42\xc6\x01\n\x1d\x63om.google.cloud.translate.v3B\x0f\x41\x64\x61ptiveMtProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" +descriptor_data = "\n+google/cloud/translate/v3/adaptive_mt.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa1\x03\n\x11\x41\x64\x61ptiveMtDataset\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x15\n\rexample_count\x18\x05 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:u\xea\x41r\n*translate.googleapis.com/AdaptiveMtDataset\x12\x44projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}\"\xad\x01\n\x1e\x43reateAdaptiveMtDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12P\n\x13\x61\x64\x61ptive_mt_dataset\x18\x02 \x01(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x02\"b\n\x1e\x44\x65leteAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"_\n\x1bGetAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"\xa0\x01\n\x1dListAdaptiveMtDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"\x91\x01\n\x1eListAdaptiveMtDatasetsResponse\x12Q\n\x14\x61\x64\x61ptive_mt_datasets\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\x9e\x08\n\x1a\x41\x64\x61ptiveMtTranslateRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x43\n\x07\x64\x61taset\x18\x02 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x07\x63ontent\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12\x11\n\tmime_type\x18\x04 \x01(\t\x12w\n\x19reference_sentence_config\x18\x06 \x01(\x0b\x32O.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfigH\x00\x88\x01\x01\x12i\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x46.google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfigB\x03\xe0\x41\x01H\x01\x88\x01\x01\x1aI\n\x15ReferenceSentencePair\x12\x17\n\x0fsource_sentence\x18\x01 \x01(\t\x12\x17\n\x0ftarget_sentence\x18\x02 \x01(\t\x1a\x8c\x01\n\x19ReferenceSentencePairList\x12o\n\x18reference_sentence_pairs\x18\x01 \x03(\x0b\x32M.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair\x1a\xcf\x01\n\x17ReferenceSentenceConfig\x12x\n\x1dreference_sentence_pair_lists\x18\x01 \x03(\x0b\x32Q.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList\x12\x1c\n\x14source_language_code\x18\x02 \x01(\t\x12\x1c\n\x14target_language_code\x18\x03 \x01(\t\x1a\x94\x01\n\x0eGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x42\x1c\n\x1a_reference_sentence_configB\x12\n\x10_glossary_config\"5\n\x15\x41\x64\x61ptiveMtTranslation\x12\x1c\n\x0ftranslated_text\x18\x01 \x01(\tB\x03\xe0\x41\x03\"\xdb\x01\n\x1b\x41\x64\x61ptiveMtTranslateResponse\x12M\n\x0ctranslations\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslationB\x03\xe0\x41\x03\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12Q\n\x15glossary_translations\x18\x04 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslation\"\x94\x03\n\x0e\x41\x64\x61ptiveMtFile\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xab\x01\xea\x41\xa7\x01\n\'translate.googleapis.com/AdaptiveMtFile\x12[projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}*\x0f\x61\x64\x61ptiveMtFiles2\x0e\x61\x64\x61ptiveMtFile\"Y\n\x18GetAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\\\n\x1b\x44\x65leteAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\xff\x01\n\x1bImportAdaptiveMtFileRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12I\n\x11\x66ile_input_source\x18\x02 \x01(\x0b\x32,.google.cloud.translation.v3.FileInputSourceH\x00\x12G\n\x10gcs_input_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"j\n\x1cImportAdaptiveMtFileResponse\x12J\n\x10\x61\x64\x61ptive_mt_file\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\"\x91\x01\n\x1aListAdaptiveMtFilesRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x88\x01\n\x1bListAdaptiveMtFilesResponse\x12K\n\x11\x61\x64\x61ptive_mt_files\x18\x01 \x03(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\xd8\x03\n\x12\x41\x64\x61ptiveMtSentence\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+translate.googleapis.com/AdaptiveMtSentence\x12\x1c\n\x0fsource_sentence\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftarget_sentence\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xd6\x01\xea\x41\xd2\x01\n+translate.googleapis.com/AdaptiveMtSentence\x12zprojects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}*\x13\x61\x64\x61ptiveMtSentences2\x12\x61\x64\x61ptiveMtSentence\"\x88\x01\n\x1eListAdaptiveMtSentencesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x94\x01\n\x1fListAdaptiveMtSentencesResponse\x12S\n\x15\x61\x64\x61ptive_mt_sentences\x18\x01 \x03(\x0b\x32/.google.cloud.translation.v3.AdaptiveMtSentenceB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\x42\xc6\x01\n\x1d\x63om.google.cloud.translate.v3B\x0f\x41\x64\x61ptiveMtProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" pool = ::Google::Protobuf::DescriptorPool.generated_pool pool.add_serialized_file(descriptor_data) diff --git a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb index 0c97b1dacdef..5f77c0a83a4f 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb @@ -2918,7 +2918,7 @@ def list_adaptive_mt_datasets request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # - # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil) + # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -2932,6 +2932,8 @@ def list_adaptive_mt_datasets request, options = nil # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` # @param content [::Array<::String>] # Required. The content of the input in string format. + # @param mime_type [::String] + # The format of the source text. # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] # Configuration for caller provided reference sentences. # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] diff --git a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb index 8aea8c3fc54c..c2350767e4ec 100644 --- a/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb +++ b/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb @@ -2737,7 +2737,7 @@ def list_adaptive_mt_datasets request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # - # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil) + # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at # least one keyword argument is required. To specify no parameters, or to keep all # the default parameter values, pass an empty Hash as a request object (see above). @@ -2751,6 +2751,8 @@ def list_adaptive_mt_datasets request, options = nil # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` # @param content [::Array<::String>] # Required. The content of the input in string format. + # @param mime_type [::String] + # The format of the source text. # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] # Configuration for caller provided reference sentences. # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] diff --git a/google-cloud-translate-v3/proto_docs/google/api/client.rb b/google-cloud-translate-v3/proto_docs/google/api/client.rb index 8f4ca4b4d6e5..e62ceba4577a 100644 --- a/google-cloud-translate-v3/proto_docs/google/api/client.rb +++ b/google-cloud-translate-v3/proto_docs/google/api/client.rb @@ -31,6 +31,8 @@ module Api # @!attribute [rw] selective_gapic_generation # @return [::Google::Api::SelectiveGapicGeneration] # Configuration for which RPCs should be generated in the GAPIC client. + # + # Note: This field should not be used in most cases. class CommonLanguageSettings include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -141,9 +143,10 @@ class Publishing # # Example of a YAML configuration:: # - # publishing: - # java_settings: - # library_package: com.google.cloud.pubsub.v1 + # publishing: + # library_settings: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 # @!attribute [rw] service_class_names # @return [::Google::Protobuf::Map{::String => ::String}] # Configure the Java class name to use instead of the service's for its @@ -155,11 +158,11 @@ class Publishing # # Example of a YAML configuration:: # - # publishing: - # java_settings: - # service_class_names: - # - google.pubsub.v1.Publisher: TopicAdmin - # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin # @!attribute [rw] common # @return [::Google::Api::CommonLanguageSettings] # Some settings. @@ -190,6 +193,20 @@ class CppSettings # @!attribute [rw] common # @return [::Google::Api::CommonLanguageSettings] # Some settings. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Php. Clobbers the php_namespace option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.php.package_name" field + # in gapic.yaml. API teams should use the protobuf php_namespace option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # php_settings: + # library_package: Google\Cloud\PubSub\V1 class PhpSettings include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -318,10 +335,12 @@ class RubySettings # service names and values are the name to be used for the service client # and call options. # - # publishing: - # go_settings: - # renamed_services: - # Publisher: TopicAdmin + # Example: + # + # publishing: + # go_settings: + # renamed_services: + # Publisher: TopicAdmin class GoSettings include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -344,10 +363,10 @@ class RenamedServicesEntry # # Example: # - # publishing: - # method_settings: - # - selector: google.storage.control.v2.StorageControl.CreateFolder - # # method settings for CreateFolder... + # publishing: + # method_settings: + # - selector: google.storage.control.v2.StorageControl.CreateFolder + # # method settings for CreateFolder... # @!attribute [rw] long_running # @return [::Google::Api::MethodSettings::LongRunning] # Describes settings to use for long-running operations when generating @@ -356,14 +375,14 @@ class RenamedServicesEntry # # Example of a YAML configuration:: # - # publishing: - # method_settings: - # - selector: google.cloud.speech.v2.Speech.BatchRecognize - # long_running: - # initial_poll_delay: 60s # 1 minute - # poll_delay_multiplier: 1.5 - # max_poll_delay: 360s # 6 minutes - # total_poll_timeout: 54000s # 90 minutes + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: 60s # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: 360s # 6 minutes + # total_poll_timeout: 54000s # 90 minutes # @!attribute [rw] auto_populated_fields # @return [::Array<::String>] # List of top-level fields of the request message, that should be @@ -372,11 +391,24 @@ class RenamedServicesEntry # # Example of a YAML configuration: # - # publishing: - # method_settings: - # - selector: google.example.v1.ExampleService.CreateExample - # auto_populated_fields: - # - request_id + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + # @!attribute [rw] batching + # @return [::Google::Api::BatchingConfigProto] + # Batching configuration for an API method in client libraries. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.BatchCreateExample + # batching: + # element_count_threshold: 1000 + # request_byte_threshold: 100000000 + # delay_threshold_millis: 10 class MethodSettings include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -411,6 +443,8 @@ class LongRunning # This message is used to configure the generation of a subset of the RPCs in # a service for client libraries. + # + # Note: This feature should not be used in most cases. # @!attribute [rw] methods # @return [::Array<::String>] # An allowlist of the fully qualified names of RPCs that should be included @@ -428,6 +462,77 @@ class SelectiveGapicGeneration extend ::Google::Protobuf::MessageExts::ClassMethods end + # `BatchingConfigProto` defines the batching configuration for an API method. + # @!attribute [rw] thresholds + # @return [::Google::Api::BatchingSettingsProto] + # The thresholds which trigger a batched request to be sent. + # @!attribute [rw] batch_descriptor + # @return [::Google::Api::BatchingDescriptorProto] + # The request and response fields used in batching. + class BatchingConfigProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingSettingsProto` specifies a set of batching thresholds, each of + # which acts as a trigger to send a batch of messages as a request. At least + # one threshold must be positive nonzero. + # @!attribute [rw] element_count_threshold + # @return [::Integer] + # The number of elements of a field collected into a batch which, if + # exceeded, causes the batch to be sent. + # @!attribute [rw] request_byte_threshold + # @return [::Integer] + # The aggregated size of the batched field which, if exceeded, causes the + # batch to be sent. This size is computed by aggregating the sizes of the + # request field to be batched, not of the entire request message. + # @!attribute [rw] delay_threshold + # @return [::Google::Protobuf::Duration] + # The duration after which a batch should be sent, starting from the addition + # of the first message to that batch. + # @!attribute [rw] element_count_limit + # @return [::Integer] + # The maximum number of elements collected in a batch that could be accepted + # by server. + # @!attribute [rw] request_byte_limit + # @return [::Integer] + # The maximum size of the request that could be accepted by server. + # @!attribute [rw] flow_control_element_limit + # @return [::Integer] + # The maximum number of elements allowed by flow control. + # @!attribute [rw] flow_control_byte_limit + # @return [::Integer] + # The maximum size of data allowed by flow control. + # @!attribute [rw] flow_control_limit_exceeded_behavior + # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] + # The behavior to take when the flow control limit is exceeded. + class BatchingSettingsProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingDescriptorProto` specifies the fields of the request message to be + # used for batching, and, optionally, the fields of the response message to be + # used for demultiplexing. + # @!attribute [rw] batched_field + # @return [::String] + # The repeated field in the request message to be aggregated by batching. + # @!attribute [rw] discriminator_fields + # @return [::Array<::String>] + # A list of the fields in the request message. Two requests will be batched + # together only if the values of every field specified in + # `request_discriminator_fields` is equal between the two requests. + # @!attribute [rw] subresponse_field + # @return [::String] + # Optional. When present, indicates the field in the response message to be + # used to demultiplex the response into multiple response messages, in + # correspondence with the multiple request messages originally batched + # together. + class BatchingDescriptorProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # The organization for which the client libraries are being published. # Affects the url where generated docs are published, etc. module ClientLibraryOrganization @@ -469,5 +574,20 @@ module ClientLibraryDestination # Publish the library to package managers like nuget.org and npmjs.com. PACKAGE_MANAGER = 20 end + + # The behavior to take when the flow control limit is exceeded. + module FlowControlLimitExceededBehaviorProto + # Default behavior, system-defined. + UNSET_BEHAVIOR = 0 + + # Stop operation, raise error. + THROW_EXCEPTION = 1 + + # Pause operation until limit clears. + BLOCK = 2 + + # Continue operation, disregard limit. + IGNORE = 3 + end end end diff --git a/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb b/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb index 5331bc55eb96..da4814987209 100644 --- a/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb +++ b/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb @@ -137,6 +137,9 @@ class ListAdaptiveMtDatasetsResponse # @!attribute [rw] content # @return [::Array<::String>] # Required. The content of the input in string format. + # @!attribute [rw] mime_type + # @return [::String] + # The format of the source text. # @!attribute [rw] reference_sentence_config # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig] # Configuration for caller provided reference sentences. diff --git a/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb b/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb index 15a918a2e371..0a383d87168c 100644 --- a/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb +++ b/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb @@ -1498,6 +1498,7 @@ def test_adaptive_mt_translate parent = "hello world" dataset = "hello world" content = ["hello world"] + mime_type = "hello world" reference_sentence_config = {} glossary_config = {} @@ -1515,27 +1516,27 @@ def test_adaptive_mt_translate end # Use hash object - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |_result, response| + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |_result, response| assert_equal http_response, response.underlying_op end # Use named arguments - client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |_result, response| + client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object - client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |_result, response| + client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |_result, response| assert_equal http_response, response.underlying_op end # Use hash object with options - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, call_options) do |_result, response| + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, call_options) do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object with options - client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), call_options) do |_result, response| + client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), call_options) do |_result, response| assert_equal http_response, response.underlying_op end diff --git a/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb b/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb index cce087db0d7c..59b9a33755c1 100644 --- a/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb +++ b/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb @@ -1698,6 +1698,7 @@ def test_adaptive_mt_translate parent = "hello world" dataset = "hello world" content = ["hello world"] + mime_type = "hello world" reference_sentence_config = {} glossary_config = {} @@ -1707,6 +1708,7 @@ def test_adaptive_mt_translate assert_equal "hello world", request["parent"] assert_equal "hello world", request["dataset"] assert_equal ["hello world"], request["content"] + assert_equal "hello world", request["mime_type"] assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig), request["reference_sentence_config"] assert request.has_reference_sentence_config? assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig), request["glossary_config"] @@ -1721,31 +1723,31 @@ def test_adaptive_mt_translate end # Use hash object - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |response, operation| + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments - client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |response, operation| + client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object - client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |response, operation| + client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, grpc_options) do |response, operation| + client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options - client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), grpc_options) do |response, operation| + client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end diff --git a/owl-bot-staging/google-cloud-translate-v3/.gitignore b/owl-bot-staging/google-cloud-translate-v3/.gitignore deleted file mode 100644 index 0135b6bc6cfc..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Ignore bundler lockfiles -Gemfile.lock -gems.locked - -# Ignore documentation output -doc/* -.yardoc/* - -# Ignore test output -coverage/* - -# Ignore build artifacts -pkg/* - -# Ignore files commonly present in certain dev environments -.vagrant -.DS_STORE -.idea -*.iml - -# Ignore synth output -__pycache__ diff --git a/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json b/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json deleted file mode 100644 index 550038f3aaea..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/.repo-metadata.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "api_id": "translate.googleapis.com", - "api_shortname": "translate", - "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest", - "distribution_name": "google-cloud-translate-v3", - "is_cloud": true, - "language": "ruby", - "name": "translate", - "name_pretty": "Cloud Translation V3 API", - "product_documentation": "https://cloud.google.com/translate", - "release_level": "unreleased", - "repo": "googleapis/google-cloud-ruby", - "requires_billing": true, - "ruby-cloud-description": "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. Note that google-cloud-translate-v3 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-translate instead. See the readme for more details.", - "ruby-cloud-env-prefix": "TRANSLATE", - "ruby-cloud-product-url": "https://cloud.google.com/translate", - "library_type": "GAPIC_AUTO" -} diff --git a/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml b/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml deleted file mode 100644 index 68b485677107..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/.rubocop.yml +++ /dev/null @@ -1,33 +0,0 @@ -inherit_gem: - google-style: google-style.yml - -AllCops: - Exclude: - - "google-cloud-translate-v3.gemspec" - - "lib/**/*_pb.rb" - - "proto_docs/**/*" - - "test/**/*" - - "acceptance/**/*" - - "samples/acceptance/**/*" - - "Rakefile" - -Layout/LineLength: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Naming/AccessorMethodName: - Exclude: - - "snippets/**/*.rb" -Naming/FileName: - Exclude: - - "lib/google-cloud-translate-v3.rb" diff --git a/owl-bot-staging/google-cloud-translate-v3/.toys.rb b/owl-bot-staging/google-cloud-translate-v3/.toys.rb deleted file mode 100644 index 177e22456e8a..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/.toys.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -toys_version! ">= 0.15.3" - -if ENV["RUBY_COMMON_TOOLS"] - common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] - load File.join(common_tools_dir, "toys", "gapic") -else - load_git remote: "https://github.com/googleapis/ruby-common-tools.git", - path: "toys/gapic", - update: true -end diff --git a/owl-bot-staging/google-cloud-translate-v3/.yardopts b/owl-bot-staging/google-cloud-translate-v3/.yardopts deleted file mode 100644 index 6a5acb03bbde..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/.yardopts +++ /dev/null @@ -1,12 +0,0 @@ ---no-private ---title="Cloud Translation V3 API" ---exclude _pb\.rb$ ---markup markdown ---markup-provider redcarpet - -./lib/**/*.rb -./proto_docs/**/*.rb -- -README.md -LICENSE.md -AUTHENTICATION.md diff --git a/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md b/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md deleted file mode 100644 index f67deb161865..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/AUTHENTICATION.md +++ /dev/null @@ -1,122 +0,0 @@ -# Authentication - -The recommended way to authenticate to the google-cloud-translate-v3 library is to use -[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). -To review all of your authentication options, see [Credentials lookup](#credential-lookup). - -## Quickstart - -The following example shows how to set up authentication for a local development -environment with your user credentials. - -**NOTE:** This method is _not_ recommended for running in production. User credentials -should be used only during development. - -1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). -2. Set up a local ADC file with your user credentials: - -```sh -gcloud auth application-default login -``` - -3. Write code as if already authenticated. - -For more information about setting up authentication for a local development environment, see -[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). - -## Credential Lookup - -The google-cloud-translate-v3 library provides several mechanisms to configure your system. -Generally, using Application Default Credentials to facilitate automatic -credentials discovery is the easist method. But if you need to explicitly specify -credentials, there are several methods available to you. - -Credentials are accepted in the following ways, in the following order or precedence: - -1. Credentials specified in method arguments -2. Credentials specified in configuration -3. Credentials pointed to or included in environment variables -4. Credentials found in local ADC file -5. Credentials returned by the metadata server for the attached service account (GCP) - -### Configuration - -You can configure a path to a JSON credentials file, either for an individual client object or -globally, for all client objects. The JSON file can contain credentials created for -[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), -[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a -[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). - -Note: Service account keys are a security risk if not managed correctly. You should -[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) -whenever possible. - -To configure a credentials file for an individual client initialization: - -```ruby -require "google/cloud/translate/v3" - -client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = "path/to/credentialfile.json" -end -``` - -To configure a credentials file globally for all clients: - -```ruby -require "google/cloud/translate/v3" - -::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| - config.credentials = "path/to/credentialfile.json" -end - -client = ::Google::Cloud::Translate::V3::TranslationService::Client.new -``` - -### Environment Variables - -You can also use an environment variable to provide a JSON credentials file. -The environment variable can contain a path to the credentials file or, for -environments such as Docker containers where writing files is not encouraged, -you can include the credentials file itself. - -The JSON file can contain credentials created for -[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), -[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a -[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). - -Note: Service account keys are a security risk if not managed correctly. You should -[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) -whenever possible. - -The environment variables that google-cloud-translate-v3 -checks for credentials are: - -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file - -```ruby -require "google/cloud/translate/v3" - -ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" - -client = ::Google::Cloud::Translate::V3::TranslationService::Client.new -``` - -### Local ADC file - -You can set up a local ADC file with your user credentials for authentication during -development. If credentials are not provided in code or in environment variables, -then the local ADC credentials are discovered. - -Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - -### Google Cloud Platform environments - -When running on Google Cloud Platform (GCP), including Google Compute Engine -(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud -Functions (GCF) and Cloud Run, credentials are retrieved from the attached -service account automatically. Code should be written as if already authenticated. - -For more information, see -[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md b/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md deleted file mode 100644 index f88957a62ba2..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Release History - diff --git a/owl-bot-staging/google-cloud-translate-v3/Gemfile b/owl-bot-staging/google-cloud-translate-v3/Gemfile deleted file mode 100644 index 1d08558908d8..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/Gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -gemspec - -gem "google-style", "~> 1.32.0" -gem "irb", "~> 1.17" -gem "minitest", "~> 6.0.2" -gem "minitest-focus", "~> 1.4" -gem "minitest-mock", "~> 5.27" -gem "minitest-rg", "~> 5.3" -gem "ostruct", "~> 0.5.5" -gem "rake", ">= 13.0" -gem "redcarpet", "~> 3.6" -gem "yard", "~> 0.9" diff --git a/owl-bot-staging/google-cloud-translate-v3/LICENSE.md b/owl-bot-staging/google-cloud-translate-v3/LICENSE.md deleted file mode 100644 index c261857ba6ad..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/LICENSE.md +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - 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. diff --git a/owl-bot-staging/google-cloud-translate-v3/README.md b/owl-bot-staging/google-cloud-translate-v3/README.md deleted file mode 100644 index 99718bb0a50c..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# Ruby Client for the Cloud Translation V3 API - -Integrates text translation into your website or application. - -Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. - -https://github.com/googleapis/google-cloud-ruby - -This gem is a _versioned_ client. It provides basic client classes for a -specific version of the Cloud Translation V3 API. Most users should consider using -the main client gem, -[google-cloud-translate](https://rubygems.org/gems/google-cloud-translate). -See the section below titled *Which client should I use?* for more information. - -## Installation - -``` -$ gem install google-cloud-translate-v3 -``` - -## Before You Begin - -In order to use this library, you first need to go through the following steps: - -1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) -1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) -1. [Enable the API.](https://console.cloud.google.com/apis/library/translate.googleapis.com) -1. [Set up authentication.](AUTHENTICATION.md) - -## Quick Start - -```ruby -require "google/cloud/translate/v3" - -client = ::Google::Cloud::Translate::V3::TranslationService::Client.new -request = ::Google::Cloud::Translate::V3::TranslateTextRequest.new # (request fields as keyword arguments...) -response = client.translate_text request -``` - -View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest) -for class and method documentation. - -See also the [Product Documentation](https://cloud.google.com/translate) -for general usage information. - -## Debug Logging - -This library comes with opt-in Debug Logging that can help you troubleshoot -your application's integration with the API. When logging is activated, key -events such as requests and responses, along with data payloads and metadata -such as headers and client configuration, are logged to the standard error -stream. - -**WARNING:** Client Library Debug Logging includes your data payloads in -plaintext, which could include sensitive data such as PII for yourself or your -customers, private keys, or other security data that could be compromising if -leaked. Always practice good data hygiene with your application logs, and follow -the principle of least access. Google also recommends that Client Library Debug -Logging be enabled only temporarily during active debugging, and not used -permanently in production. - -To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` -to the value `all`. Alternatively, you can set the value to a comma-delimited -list of client library gem names. This will select the default logging behavior, -which writes logs to the standard error stream. On a local workstation, this may -result in logs appearing on the console. When running on a Google Cloud hosting -service such as [Google Cloud Run](https://cloud.google.com/run), this generally -results in logs appearing alongside your application logs in the -[Google Cloud Logging](https://cloud.google.com/logging/) service. - -You can customize logging by modifying the `logger` configuration when -constructing a client object. For example: - -```ruby -require "google/cloud/translate/v3" -require "logger" - -client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.logger = Logger.new "my-app.log" -end -``` - -## Google Cloud Samples - -To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). - -## Supported Ruby Versions - -This library is supported on Ruby 3.0+. - -Google provides official support for Ruby versions that are actively supported -by Ruby Core—that is, Ruby versions that are either in normal maintenance or -in security maintenance, and not end of life. Older versions of Ruby _may_ -still work, but are unsupported and not recommended. See -https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby -support schedule. - -## Which client should I use? - -Most modern Ruby client libraries for Google APIs come in two flavors: the main -client library with a name such as `google-cloud-translate`, -and lower-level _versioned_ client libraries with names such as -`google-cloud-translate-v3`. -_In most cases, you should install the main client._ - -### What's the difference between the main client and a versioned client? - -A _versioned client_ provides a basic set of data types and client classes for -a _single version_ of a specific service. (That is, for a service with multiple -versions, there might be a separate versioned client for each service version.) -Most versioned clients are written and maintained by a code generator. - -The _main client_ is designed to provide you with the _recommended_ client -interfaces for the service. There will be only one main client for any given -service, even a service with multiple versions. The main client includes -factory methods for constructing the client objects we recommend for most -users. In some cases, those will be classes provided by an underlying versioned -client; in other cases, they will be handwritten higher-level client objects -with additional capabilities, convenience methods, or best practices built in. -Generally, the main client will default to a recommended service version, -although in some cases you can override this if you need to talk to a specific -service version. - -### Why would I want to use the main client? - -We recommend that most users install the main client gem for a service. You can -identify this gem as the one _without_ a version in its name, e.g. -`google-cloud-translate`. -The main client is recommended because it will embody the best practices for -accessing the service, and may also provide more convenient interfaces or -tighter integration into frameworks and third-party libraries. In addition, the -documentation and samples published by Google will generally demonstrate use of -the main client. - -### Why would I want to use a versioned client? - -You can use a versioned client if you are content with a possibly lower-level -class interface, you explicitly want to avoid features provided by the main -client, or you want to access a specific service version not be covered by the -main client. You can identify versioned client gems because the service version -is part of the name, e.g. `google-cloud-translate-v3`. - -### What about the google-apis- clients? - -Client library gems with names that begin with `google-apis-` are based on an -older code generation technology. They talk to a REST/JSON backend (whereas -most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may -not offer the same performance, features, and ease of use provided by more -modern clients. - -The `google-apis-` clients have wide coverage across Google services, so you -might need to use one if there is no modern client available for the service. -However, if a modern client is available, we generally recommend it over the -older `google-apis-` clients. diff --git a/owl-bot-staging/google-cloud-translate-v3/Rakefile b/owl-bot-staging/google-cloud-translate-v3/Rakefile deleted file mode 100644 index 06aca81cc0ab..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/Rakefile +++ /dev/null @@ -1,169 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "bundler/setup" -require "bundler/gem_tasks" - -require "rubocop/rake_task" -RuboCop::RakeTask.new - -require "rake/testtask" -desc "Run tests." -Rake::TestTask.new do |t| - t.libs << "test" - t.test_files = FileList["test/**/*_test.rb"] - t.warning = false -end - -desc "Runs the smoke tests." -Rake::TestTask.new :smoke_test do |t| - t.test_files = FileList["acceptance/**/*smoke_test.rb"] - t.warning = false -end - -# Acceptance tests -desc "Run the google-cloud-translate-v3 acceptance tests." -task :acceptance, :project, :keyfile do |t, args| - project = args[:project] - project ||= - ENV["TRANSLATE_TEST_PROJECT"] || - ENV["GCLOUD_TEST_PROJECT"] - keyfile = args[:keyfile] - keyfile ||= - ENV["TRANSLATE_TEST_KEYFILE"] || - ENV["GCLOUD_TEST_KEYFILE"] - if keyfile - keyfile = File.read keyfile - else - keyfile ||= - ENV["TRANSLATE_TEST_KEYFILE_JSON"] || - ENV["GCLOUD_TEST_KEYFILE_JSON"] - end - if project.nil? || keyfile.nil? - fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or TRANSLATE_TEST_PROJECT=test123 TRANSLATE_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" - end - require "google/cloud/translate/v3/translation_service/credentials" - ::Google::Cloud::Translate::V3::TranslationService::Credentials.env_vars.each do |path| - ENV[path] = nil - end - ENV["TRANSLATE_PROJECT"] = project - ENV["TRANSLATE_TEST_PROJECT"] = project - ENV["TRANSLATE_KEYFILE_JSON"] = keyfile - - Rake::Task["acceptance:run"].invoke -end - -namespace :acceptance do - task :run do - if File.directory? "acceptance" - Rake::Task[:smoke_test].invoke - else - puts "The google-cloud-translate-v3 gem has no acceptance tests." - end - end - - desc "Run acceptance cleanup." - task :cleanup do - end -end - -task :samples do - Rake::Task["samples:latest"].invoke -end - -namespace :samples do - task :latest do - if File.directory? "samples" - Dir.chdir "samples" do - Bundler.with_clean_env do - ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" - sh "bundle update" - sh "bundle exec rake test" - end - end - else - puts "The google-cloud-translate-v3 gem has no samples to test." - end - end - - task :master do - if File.directory? "samples" - Dir.chdir "samples" do - Bundler.with_clean_env do - ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" - sh "bundle update" - sh "bundle exec rake test" - end - end - else - puts "The google-cloud-translate-v3 gem has no samples to test." - end - end -end - -require "yard" -require "yard/rake/yardoc_task" -YARD::Rake::YardocTask.new do |y| - y.options << "--fail-on-warning" -end - -desc "Run yard-doctest example tests." -task :doctest do - puts "The google-cloud-translate-v3 gem does not have doctest tests." -end - -desc "Run the CI build" -task :ci do - header "BUILDING google-cloud-translate-v3" - header "google-cloud-translate-v3 rubocop", "*" - Rake::Task[:rubocop].invoke - header "google-cloud-translate-v3 yard", "*" - Rake::Task[:yard].invoke - header "google-cloud-translate-v3 test", "*" - Rake::Task[:test].invoke -end - -namespace :ci do - desc "Run the CI build, with smoke tests." - task :smoke_test do - Rake::Task[:ci].invoke - header "google-cloud-translate-v3 smoke_test", "*" - Rake::Task[:smoke_test].invoke - end - desc "Run the CI build, with acceptance tests." - task :acceptance do - Rake::Task[:ci].invoke - header "google-cloud-translate-v3 acceptance", "*" - Rake::Task[:acceptance].invoke - end - task :a do - # This is a handy shortcut to save typing - Rake::Task["ci:acceptance"].invoke - end -end - -task default: :test - -def header str, token = "#" - line_length = str.length + 8 - puts "" - puts token * line_length - puts "#{token * 3} #{str} #{token * 3}" - puts token * line_length - puts "" -end diff --git a/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json b/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json deleted file mode 100644 index e12339b2e4a4..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/gapic_metadata.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "ruby", - "protoPackage": "google.cloud.translation.v3", - "libraryPackage": "::Google::Cloud::Translate::V3", - "services": { - "TranslationService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Translate::V3::TranslationService::Client", - "rpcs": { - "TranslateText": { - "methods": [ - "translate_text" - ] - }, - "RomanizeText": { - "methods": [ - "romanize_text" - ] - }, - "DetectLanguage": { - "methods": [ - "detect_language" - ] - }, - "GetSupportedLanguages": { - "methods": [ - "get_supported_languages" - ] - }, - "TranslateDocument": { - "methods": [ - "translate_document" - ] - }, - "BatchTranslateText": { - "methods": [ - "batch_translate_text" - ] - }, - "BatchTranslateDocument": { - "methods": [ - "batch_translate_document" - ] - }, - "CreateGlossary": { - "methods": [ - "create_glossary" - ] - }, - "UpdateGlossary": { - "methods": [ - "update_glossary" - ] - }, - "ListGlossaries": { - "methods": [ - "list_glossaries" - ] - }, - "GetGlossary": { - "methods": [ - "get_glossary" - ] - }, - "DeleteGlossary": { - "methods": [ - "delete_glossary" - ] - }, - "GetGlossaryEntry": { - "methods": [ - "get_glossary_entry" - ] - }, - "ListGlossaryEntries": { - "methods": [ - "list_glossary_entries" - ] - }, - "CreateGlossaryEntry": { - "methods": [ - "create_glossary_entry" - ] - }, - "UpdateGlossaryEntry": { - "methods": [ - "update_glossary_entry" - ] - }, - "DeleteGlossaryEntry": { - "methods": [ - "delete_glossary_entry" - ] - }, - "CreateDataset": { - "methods": [ - "create_dataset" - ] - }, - "GetDataset": { - "methods": [ - "get_dataset" - ] - }, - "ListDatasets": { - "methods": [ - "list_datasets" - ] - }, - "DeleteDataset": { - "methods": [ - "delete_dataset" - ] - }, - "CreateAdaptiveMtDataset": { - "methods": [ - "create_adaptive_mt_dataset" - ] - }, - "DeleteAdaptiveMtDataset": { - "methods": [ - "delete_adaptive_mt_dataset" - ] - }, - "GetAdaptiveMtDataset": { - "methods": [ - "get_adaptive_mt_dataset" - ] - }, - "ListAdaptiveMtDatasets": { - "methods": [ - "list_adaptive_mt_datasets" - ] - }, - "AdaptiveMtTranslate": { - "methods": [ - "adaptive_mt_translate" - ] - }, - "GetAdaptiveMtFile": { - "methods": [ - "get_adaptive_mt_file" - ] - }, - "DeleteAdaptiveMtFile": { - "methods": [ - "delete_adaptive_mt_file" - ] - }, - "ImportAdaptiveMtFile": { - "methods": [ - "import_adaptive_mt_file" - ] - }, - "ListAdaptiveMtFiles": { - "methods": [ - "list_adaptive_mt_files" - ] - }, - "ListAdaptiveMtSentences": { - "methods": [ - "list_adaptive_mt_sentences" - ] - }, - "ImportData": { - "methods": [ - "import_data" - ] - }, - "ExportData": { - "methods": [ - "export_data" - ] - }, - "ListExamples": { - "methods": [ - "list_examples" - ] - }, - "CreateModel": { - "methods": [ - "create_model" - ] - }, - "ListModels": { - "methods": [ - "list_models" - ] - }, - "GetModel": { - "methods": [ - "get_model" - ] - }, - "DeleteModel": { - "methods": [ - "delete_model" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec b/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec deleted file mode 100644 index b3eb7135a809..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/google-cloud-translate-v3.gemspec +++ /dev/null @@ -1,30 +0,0 @@ -# -*- ruby -*- -# encoding: utf-8 - -require File.expand_path("lib/google/cloud/translate/v3/version", __dir__) - -Gem::Specification.new do |gem| - gem.name = "google-cloud-translate-v3" - gem.version = Google::Cloud::Translate::V3::VERSION - - gem.authors = ["Google LLC"] - gem.email = "googleapis-packages@google.com" - gem.description = "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service. Note that google-cloud-translate-v3 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-translate instead. See the readme for more details." - gem.summary = "Integrates text translation into your website or application." - gem.homepage = "https://github.com/googleapis/google-cloud-ruby" - gem.license = "Apache-2.0" - - gem.platform = Gem::Platform::RUBY - - gem.files = `git ls-files -- lib/*`.split("\n") + - `git ls-files -- proto_docs/*`.split("\n") + - ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] - gem.require_paths = ["lib"] - - gem.required_ruby_version = ">= 3.2" - - gem.add_dependency "gapic-common", "~> 1.2" - gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", "~> 1.0" - gem.add_dependency "google-iam-v1", "~> 1.3" -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb deleted file mode 100644 index 4feb19bf3cb3..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google-cloud-translate-v3.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# This gem does not autoload during Bundler.require. To load this gem, -# issue explicit require statements for the packages desired, e.g.: -# require "google/cloud/translate/v3" diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb deleted file mode 100644 index 9da4decef7f8..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/translate/v3/translation_service" -require "google/cloud/translate/v3/version" - -module Google - module Cloud - module Translate - ## - # API client module. - # - # @example Load this package, including all its services, and instantiate a gRPC client - # - # require "google/cloud/translate/v3" - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new - # - # @example Load this package, including all its services, and instantiate a REST client - # - # require "google/cloud/translate/v3" - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - module V3 - end - end - end -end - -helper_path = ::File.join __dir__, "v3", "_helpers.rb" -require "google/cloud/translate/v3/_helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb deleted file mode 100644 index a65944af7001..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/adaptive_mt_pb.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/translate/v3/adaptive_mt.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/translate/v3/common_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n+google/cloud/translate/v3/adaptive_mt.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa1\x03\n\x11\x41\x64\x61ptiveMtDataset\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x15\n\rexample_count\x18\x05 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:u\xea\x41r\n*translate.googleapis.com/AdaptiveMtDataset\x12\x44projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}\"\xad\x01\n\x1e\x43reateAdaptiveMtDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12P\n\x13\x61\x64\x61ptive_mt_dataset\x18\x02 \x01(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x02\"b\n\x1e\x44\x65leteAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"_\n\x1bGetAdaptiveMtDatasetRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\"\xa0\x01\n\x1dListAdaptiveMtDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"\x91\x01\n\x1eListAdaptiveMtDatasetsResponse\x12Q\n\x14\x61\x64\x61ptive_mt_datasets\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.AdaptiveMtDatasetB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\x9e\x08\n\x1a\x41\x64\x61ptiveMtTranslateRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x43\n\x07\x64\x61taset\x18\x02 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x14\n\x07\x63ontent\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12\x11\n\tmime_type\x18\x04 \x01(\t\x12w\n\x19reference_sentence_config\x18\x06 \x01(\x0b\x32O.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfigH\x00\x88\x01\x01\x12i\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x46.google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfigB\x03\xe0\x41\x01H\x01\x88\x01\x01\x1aI\n\x15ReferenceSentencePair\x12\x17\n\x0fsource_sentence\x18\x01 \x01(\t\x12\x17\n\x0ftarget_sentence\x18\x02 \x01(\t\x1a\x8c\x01\n\x19ReferenceSentencePairList\x12o\n\x18reference_sentence_pairs\x18\x01 \x03(\x0b\x32M.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair\x1a\xcf\x01\n\x17ReferenceSentenceConfig\x12x\n\x1dreference_sentence_pair_lists\x18\x01 \x03(\x0b\x32Q.google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList\x12\x1c\n\x14source_language_code\x18\x02 \x01(\t\x12\x1c\n\x14target_language_code\x18\x03 \x01(\t\x1a\x94\x01\n\x0eGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x42\x1c\n\x1a_reference_sentence_configB\x12\n\x10_glossary_config\"5\n\x15\x41\x64\x61ptiveMtTranslation\x12\x1c\n\x0ftranslated_text\x18\x01 \x01(\tB\x03\xe0\x41\x03\"\xdb\x01\n\x1b\x41\x64\x61ptiveMtTranslateResponse\x12M\n\x0ctranslations\x18\x01 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslationB\x03\xe0\x41\x03\x12\x1a\n\rlanguage_code\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12Q\n\x15glossary_translations\x18\x04 \x03(\x0b\x32\x32.google.cloud.translation.v3.AdaptiveMtTranslation\"\x94\x03\n\x0e\x41\x64\x61ptiveMtFile\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x65ntry_count\x18\x03 \x01(\x05\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xab\x01\xea\x41\xa7\x01\n\'translate.googleapis.com/AdaptiveMtFile\x12[projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}*\x0f\x61\x64\x61ptiveMtFiles2\x0e\x61\x64\x61ptiveMtFile\"Y\n\x18GetAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\\\n\x1b\x44\x65leteAdaptiveMtFileRequest\x12=\n\x04name\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\"\xff\x01\n\x1bImportAdaptiveMtFileRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12I\n\x11\x66ile_input_source\x18\x02 \x01(\x0b\x32,.google.cloud.translation.v3.FileInputSourceH\x00\x12G\n\x10gcs_input_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"j\n\x1cImportAdaptiveMtFileResponse\x12J\n\x10\x61\x64\x61ptive_mt_file\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\"\x91\x01\n\x1aListAdaptiveMtFilesRequest\x12\x42\n\x06parent\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*translate.googleapis.com/AdaptiveMtDataset\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x88\x01\n\x1bListAdaptiveMtFilesResponse\x12K\n\x11\x61\x64\x61ptive_mt_files\x18\x01 \x03(\x0b\x32+.google.cloud.translation.v3.AdaptiveMtFileB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\xd8\x03\n\x12\x41\x64\x61ptiveMtSentence\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+translate.googleapis.com/AdaptiveMtSentence\x12\x1c\n\x0fsource_sentence\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftarget_sentence\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:\xd6\x01\xea\x41\xd2\x01\n+translate.googleapis.com/AdaptiveMtSentence\x12zprojects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}*\x13\x61\x64\x61ptiveMtSentences2\x12\x61\x64\x61ptiveMtSentence\"\x88\x01\n\x1eListAdaptiveMtSentencesRequest\x12?\n\x06parent\x18\x01 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'translate.googleapis.com/AdaptiveMtFile\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x94\x01\n\x1fListAdaptiveMtSentencesResponse\x12S\n\x15\x61\x64\x61ptive_mt_sentences\x18\x01 \x03(\x0b\x32/.google.cloud.translation.v3.AdaptiveMtSentenceB\x03\xe0\x41\x03\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\x42\xc6\x01\n\x1d\x63om.google.cloud.translate.v3B\x0f\x41\x64\x61ptiveMtProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Translate - module V3 - AdaptiveMtDataset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtDataset").msgclass - CreateAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest").msgclass - DeleteAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest").msgclass - GetAdaptiveMtDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetAdaptiveMtDatasetRequest").msgclass - ListAdaptiveMtDatasetsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest").msgclass - ListAdaptiveMtDatasetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse").msgclass - AdaptiveMtTranslateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest").msgclass - AdaptiveMtTranslateRequest::ReferenceSentencePair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePair").msgclass - AdaptiveMtTranslateRequest::ReferenceSentencePairList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentencePairList").msgclass - AdaptiveMtTranslateRequest::ReferenceSentenceConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.ReferenceSentenceConfig").msgclass - AdaptiveMtTranslateRequest::GlossaryConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateRequest.GlossaryConfig").msgclass - AdaptiveMtTranslation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslation").msgclass - AdaptiveMtTranslateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtTranslateResponse").msgclass - AdaptiveMtFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtFile").msgclass - GetAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetAdaptiveMtFileRequest").msgclass - DeleteAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteAdaptiveMtFileRequest").msgclass - ImportAdaptiveMtFileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportAdaptiveMtFileRequest").msgclass - ImportAdaptiveMtFileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportAdaptiveMtFileResponse").msgclass - ListAdaptiveMtFilesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtFilesRequest").msgclass - ListAdaptiveMtFilesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtFilesResponse").msgclass - AdaptiveMtSentence = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.AdaptiveMtSentence").msgclass - ListAdaptiveMtSentencesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtSentencesRequest").msgclass - ListAdaptiveMtSentencesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListAdaptiveMtSentencesResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb deleted file mode 100644 index a9711e27fbe7..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/automl_translation_pb.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/translate/v3/automl_translation.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/translate/v3/common_pb' -require 'google/protobuf/timestamp_pb' -require 'google/rpc/status_pb' - - -descriptor_data = "\n2google/cloud/translate/v3/automl_translation.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\"u\n\x11ImportDataRequest\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12J\n\x0cinput_config\x18\x02 \x01(\x0b\x32/.google.cloud.translation.v3.DatasetInputConfigB\x03\xe0\x41\x02\"\xd2\x01\n\x12\x44\x61tasetInputConfig\x12N\n\x0binput_files\x18\x01 \x03(\x0b\x32\x39.google.cloud.translation.v3.DatasetInputConfig.InputFile\x1al\n\tInputFile\x12\x12\n\x05usage\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x41\n\ngcs_source\x18\x03 \x01(\x0b\x32+.google.cloud.translation.v3.GcsInputSourceH\x00\x42\x08\n\x06source\"\xd5\x01\n\x12ImportDataMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"w\n\x11\x45xportDataRequest\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12L\n\routput_config\x18\x02 \x01(\x0b\x32\x30.google.cloud.translation.v3.DatasetOutputConfigB\x03\xe0\x41\x02\"r\n\x13\x44\x61tasetOutputConfig\x12L\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x31.google.cloud.translation.v3.GcsOutputDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\xd5\x01\n\x12\x45xportDataMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"N\n\x14\x44\x65leteDatasetRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\"\xd8\x01\n\x15\x44\x65leteDatasetMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"K\n\x11GetDatasetRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\"\x81\x01\n\x13ListDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"g\n\x14ListDatasetsResponse\x12\x36\n\x08\x64\x61tasets\x18\x01 \x03(\x0b\x32$.google.cloud.translation.v3.Dataset\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x8d\x01\n\x14\x43reateDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12:\n\x07\x64\x61taset\x18\x02 \x01(\x0b\x32$.google.cloud.translation.v3.DatasetB\x03\xe0\x41\x02\"\xd8\x01\n\x15\x43reateDatasetMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\x95\x01\n\x13ListExamplesRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41\"\n translate.googleapis.com/Dataset\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\"g\n\x14ListExamplesResponse\x12\x36\n\x08\x65xamples\x18\x01 \x03(\x0b\x32$.google.cloud.translation.v3.Example\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xd0\x01\n\x07\x45xample\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x13\n\x0bsource_text\x18\x02 \x01(\t\x12\x13\n\x0btarget_text\x18\x03 \x01(\t\x12\x12\n\x05usage\x18\x04 \x01(\tB\x03\xe0\x41\x03:t\xea\x41q\n translate.googleapis.com/Example\x12Mprojects/{project}/locations/{location}/datasets/{dataset}/examples/{example}\"\xe8\x01\n\x1e\x42\x61tchTransferResourcesResponse\x12g\n\tresponses\x18\x01 \x03(\x0b\x32T.google.cloud.translation.v3.BatchTransferResourcesResponse.TransferResourceResponse\x1a]\n\x18TransferResourceResponse\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0e\n\x06target\x18\x02 \x01(\t\x12!\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x12.google.rpc.Status\"\xbc\x03\n\x07\x44\x61taset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x1c\n\x14source_language_code\x18\x03 \x01(\t\x12\x1c\n\x14target_language_code\x18\x04 \x01(\t\x12\x1a\n\rexample_count\x18\x05 \x01(\x05\x42\x03\xe0\x41\x03\x12 \n\x13train_example_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12#\n\x16validate_example_count\x18\x07 \x01(\x05\x42\x03\xe0\x41\x03\x12\x1f\n\x12test_example_count\x18\x08 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:a\xea\x41^\n translate.googleapis.com/Dataset\x12:projects/{project}/locations/{location}/datasets/{dataset}\"\x87\x01\n\x12\x43reateModelRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x36\n\x05model\x18\x02 \x01(\x0b\x32\".google.cloud.translation.v3.ModelB\x03\xe0\x41\x02\"\xd6\x01\n\x13\x43reateModelMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\x94\x01\n\x11ListModelsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"a\n\x12ListModelsResponse\x12\x32\n\x06models\x18\x01 \x03(\x0b\x32\".google.cloud.translation.v3.Model\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"G\n\x0fGetModelRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1etranslate.googleapis.com/Model\"J\n\x12\x44\x65leteModelRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1etranslate.googleapis.com/Model\"\xd6\x01\n\x13\x44\x65leteModelMetadata\x12:\n\x05state\x18\x01 \x01(\x0e\x32+.google.cloud.translation.v3.OperationState\x12/\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12!\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x12.google.rpc.Status\"\xb3\x03\n\x05Model\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x61taset\x18\x03 \x01(\t\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x03\x12 \n\x13train_example_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12#\n\x16validate_example_count\x18\x07 \x01(\x05\x42\x03\xe0\x41\x03\x12\x1f\n\x12test_example_count\x18\x0c \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03:[\xea\x41X\n\x1etranslate.googleapis.com/Model\x12\x36projects/{project}/locations/{location}/models/{model}B\xcd\x01\n\x1d\x63om.google.cloud.translate.v3B\x16\x41utoMLTranslationProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Translate - module V3 - ImportDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportDataRequest").msgclass - DatasetInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetInputConfig").msgclass - DatasetInputConfig::InputFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetInputConfig.InputFile").msgclass - ImportDataMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ImportDataMetadata").msgclass - ExportDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ExportDataRequest").msgclass - DatasetOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DatasetOutputConfig").msgclass - ExportDataMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ExportDataMetadata").msgclass - DeleteDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteDatasetRequest").msgclass - DeleteDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteDatasetMetadata").msgclass - GetDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetDatasetRequest").msgclass - ListDatasetsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListDatasetsRequest").msgclass - ListDatasetsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListDatasetsResponse").msgclass - CreateDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateDatasetRequest").msgclass - CreateDatasetMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateDatasetMetadata").msgclass - ListExamplesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListExamplesRequest").msgclass - ListExamplesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListExamplesResponse").msgclass - Example = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Example").msgclass - BatchTransferResourcesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTransferResourcesResponse").msgclass - BatchTransferResourcesResponse::TransferResourceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTransferResourcesResponse.TransferResourceResponse").msgclass - Dataset = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Dataset").msgclass - CreateModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateModelRequest").msgclass - CreateModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateModelMetadata").msgclass - ListModelsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListModelsRequest").msgclass - ListModelsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListModelsResponse").msgclass - GetModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetModelRequest").msgclass - DeleteModelRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteModelRequest").msgclass - DeleteModelMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteModelMetadata").msgclass - Model = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Model").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb deleted file mode 100644 index 780f191863aa..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/bindings_override.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" - -module Google - module Cloud - module Translate - ## - # @example Loading just the REST part of this package, including all its services, and instantiating a REST client - # - # require "google/cloud/translate/v3/rest" - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - module V3 - ## - # @private - # Initialize the mixin bindings configuration - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Translate"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - - default_config = ::Gapic::Rest::HttpBindingOverrideConfiguration.new parent_config - default_config.bindings_override["google.cloud.location.Locations.GetLocation"] = [ - Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ], - body: nil - ) - ] - default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [ - - Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation( - uri_method: :get, - uri_template: "/v3/{name}/locations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ], - body: nil - ) - ] - default_config - end - yield @configure if block_given? - @configure - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb deleted file mode 100644 index a0a6b10db393..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/common_pb.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/translate/v3/common.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' - - -descriptor_data = "\n&google/cloud/translate/v3/common.proto\x12\x1bgoogle.cloud.translation.v3\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\"(\n\x0eGcsInputSource\x12\x16\n\tinput_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\"Z\n\x0f\x46ileInputSource\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07\x63ontent\x18\x02 \x01(\x0c\x42\x03\xe0\x41\x02\x12\x19\n\x0c\x64isplay_name\x18\x03 \x01(\tB\x03\xe0\x41\x02\"6\n\x14GcsOutputDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\"\xf8\x04\n\rGlossaryEntry\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12R\n\nterms_pair\x18\x02 \x01(\x0b\x32<.google.cloud.translation.v3.GlossaryEntry.GlossaryTermsPairH\x00\x12P\n\tterms_set\x18\x03 \x01(\x0b\x32;.google.cloud.translation.v3.GlossaryEntry.GlossaryTermsSetH\x00\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t\x1a\x93\x01\n\x11GlossaryTermsPair\x12>\n\x0bsource_term\x18\x01 \x01(\x0b\x32).google.cloud.translation.v3.GlossaryTerm\x12>\n\x0btarget_term\x18\x02 \x01(\x0b\x32).google.cloud.translation.v3.GlossaryTerm\x1aL\n\x10GlossaryTermsSet\x12\x38\n\x05terms\x18\x01 \x03(\x0b\x32).google.cloud.translation.v3.GlossaryTerm:\xac\x01\xea\x41\xa8\x01\n&translate.googleapis.com/GlossaryEntry\x12^projects/{project}/locations/{location}/glossaries/{glossary}/glossaryEntries/{glossary_entry}*\x0fglossaryEntries2\rglossaryEntryB\x06\n\x04\x64\x61ta\"3\n\x0cGlossaryTerm\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x0c\n\x04text\x18\x02 \x01(\t*\xc8\x01\n\x0eOperationState\x12\x1f\n\x1bOPERATION_STATE_UNSPECIFIED\x10\x00\x12\x1b\n\x17OPERATION_STATE_RUNNING\x10\x01\x12\x1d\n\x19OPERATION_STATE_SUCCEEDED\x10\x02\x12\x1a\n\x16OPERATION_STATE_FAILED\x10\x03\x12\x1e\n\x1aOPERATION_STATE_CANCELLING\x10\x04\x12\x1d\n\x19OPERATION_STATE_CANCELLED\x10\x05\x42\xc2\x01\n\x1d\x63om.google.cloud.translate.v3B\x0b\x43ommonProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Translate - module V3 - GcsInputSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsInputSource").msgclass - FileInputSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.FileInputSource").msgclass - GcsOutputDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsOutputDestination").msgclass - GlossaryEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry").msgclass - GlossaryEntry::GlossaryTermsPair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry.GlossaryTermsPair").msgclass - GlossaryEntry::GlossaryTermsSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryEntry.GlossaryTermsSet").msgclass - GlossaryTerm = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryTerm").msgclass - OperationState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.OperationState").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb deleted file mode 100644 index a65a2908a2bd..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/rest.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/translate/v3/translation_service/rest" -require "google/cloud/translate/v3/bindings_override" -require "google/cloud/translate/v3/version" - -module Google - module Cloud - module Translate - ## - # To load just the REST part of this package, including all its services, and instantiate a REST client: - # - # @example - # - # require "google/cloud/translate/v3/rest" - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - module V3 - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb deleted file mode 100644 index 95ca52623d45..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/translate/v3/version" - -require "google/cloud/translate/v3/translation_service/credentials" -require "google/cloud/translate/v3/translation_service/paths" -require "google/cloud/translate/v3/translation_service/operations" -require "google/cloud/translate/v3/translation_service/client" -require "google/cloud/translate/v3/translation_service/rest" - -module Google - module Cloud - module Translate - module V3 - ## - # Provides natural language translation operations. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/translate/v3/translation_service" - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/translate/v3/translation_service/rest" - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - module TranslationService - end - end - end - end -end - -helper_path = ::File.join __dir__, "translation_service", "helpers.rb" -require "google/cloud/translate/v3/translation_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb deleted file mode 100644 index f55ab86a53b3..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/client.rb +++ /dev/null @@ -1,4616 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/translate/v3/translation_service_pb" -require "google/cloud/location" -require "google/iam/v1" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - ## - # Client for the TranslationService service. - # - # Provides natural language translation operations. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :translation_service_stub - - ## - # Configure the TranslationService Client class. - # - # See {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all TranslationService clients - # ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Translate", "V3"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.rpcs.translate_text.timeout = 600.0 - - default_config.rpcs.detect_language.timeout = 600.0 - - default_config.rpcs.get_supported_languages.timeout = 600.0 - default_config.rpcs.get_supported_languages.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.translate_document.timeout = 600.0 - - default_config.rpcs.batch_translate_text.timeout = 600.0 - - default_config.rpcs.batch_translate_document.timeout = 600.0 - - default_config.rpcs.create_glossary.timeout = 600.0 - - default_config.rpcs.list_glossaries.timeout = 600.0 - default_config.rpcs.list_glossaries.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.get_glossary.timeout = 600.0 - default_config.rpcs.get_glossary.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.delete_glossary.timeout = 600.0 - default_config.rpcs.delete_glossary.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the TranslationService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @translation_service_stub.universe_domain - end - - ## - # Create a new TranslationService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the TranslationService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/translate/v3/translation_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @translation_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Translate::V3::TranslationService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @translation_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @translation_service_stub.endpoint - config.universe_domain = @translation_service_stub.universe_domain - config.logger = @translation_service_stub.logger if config.respond_to? :logger= - end - - @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @translation_service_stub.endpoint - config.universe_domain = @translation_service_stub.universe_domain - config.logger = @translation_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Translate::V3::TranslationService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # Get the associated client for mix-in of the IAMPolicy. - # - # @return [Google::Iam::V1::IAMPolicy::Client] - # - attr_reader :iam_policy_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @translation_service_stub.logger - end - - # Service calls - - ## - # Translates input text and returns translated text. - # - # @overload translate_text(request, options = nil) - # Pass arguments to `translate_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::TranslateTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::TranslateTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) - # Pass arguments to `translate_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param contents [::Array<::String>] - # Required. The content of the input in string format. - # We recommend the total content be less than 30,000 codepoints. The max - # length of this field is 1024. Use BatchTranslateText for larger text. - # @param mime_type [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @param source_language_code [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "en-US" or "sr-Latn". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). If the source - # language isn't specified, the API attempts to identify the source language - # automatically and returns the source language within the response. - # @param target_language_code [::String] - # Required. The ISO-639 language code to use for translation of the input - # text, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 same - # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - # @param model [::String] - # 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`, - # - # - Translation LLM models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, - # - # For global (non-regionalized) requests, use `location-id` `global`. - # For example, - # `projects/{project-number-or-id}/locations/global/models/general/nmt`. - # - # If not provided, the default Google model (NMT) will be used - # @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] - # 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 transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash] - # Optional. Transliteration to be applied. - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::TranslateTextResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::TranslateTextRequest.new - # - # # Call the translate_text method. - # result = client.translate_text request - # - # # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. - # p result - # - def translate_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.translate_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.translate_text.timeout, - metadata: metadata, - retry_policy: @config.rpcs.translate_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :translate_text, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Romanize input text written in non-Latin scripts to Latin text. - # - # @overload romanize_text(request, options = nil) - # Pass arguments to `romanize_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload romanize_text(parent: nil, contents: nil, source_language_code: nil) - # Pass arguments to `romanize_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # @param contents [::Array<::String>] - # Required. The content of the input in string format. - # @param source_language_code [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "hi" or "zh". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages#roman). If the - # source language isn't specified, the API attempts to identify the source - # language automatically and returns the source language for each content in - # the response. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::RomanizeTextRequest.new - # - # # Call the romanize_text method. - # result = client.romanize_text request - # - # # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. - # p result - # - def romanize_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.romanize_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.romanize_text.timeout, - metadata: metadata, - retry_policy: @config.rpcs.romanize_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :romanize_text, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Detects the language of text within a request. - # - # @overload detect_language(request, options = nil) - # Pass arguments to `detect_language` via a request object, either of type - # {::Google::Cloud::Translate::V3::DetectLanguageRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) - # Pass arguments to `detect_language` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # - # Only models within the same region (has same location-id) can be used. - # Otherwise an INVALID_ARGUMENT (400) error is returned. - # @param model [::String] - # Optional. The language detection model to be used. - # - # Format: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - # - # Only one language detection model is currently supported: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - # - # If not specified, the default model is used. - # @param content [::String] - # The content of the input stored as a string. - # @param mime_type [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DetectLanguageRequest.new - # - # # Call the detect_language method. - # result = client.detect_language request - # - # # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. - # p result - # - def detect_language request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DetectLanguageRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.detect_language.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.detect_language.timeout, - metadata: metadata, - retry_policy: @config.rpcs.detect_language.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :detect_language, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Returns a list of supported languages for translation. - # - # @overload get_supported_languages(request, options = nil) - # Pass arguments to `get_supported_languages` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_supported_languages(parent: nil, display_language_code: nil, model: nil) - # Pass arguments to `get_supported_languages` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 AutoML models. - # - # Only models within the same region (have same location-id) can be used, - # otherwise an INVALID_ARGUMENT (400) error is returned. - # @param display_language_code [::String] - # Optional. The language to use to return localized, human readable names - # of supported languages. If missing, then display names are not returned - # in a response. - # @param model [::String] - # Optional. Get supported languages of this model. - # - # 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`, - # - # - # Returns languages supported by the specified model. - # If missing, we get supported languages of Google general NMT model. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::SupportedLanguages] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::SupportedLanguages] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new - # - # # Call the get_supported_languages method. - # result = client.get_supported_languages request - # - # # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. - # p result - # - def get_supported_languages request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_supported_languages.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_supported_languages.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_supported_languages.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_supported_languages, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Translates documents in synchronous mode. - # - # @overload translate_document(request, options = nil) - # Pass arguments to `translate_document` via a request object, either of type - # {::Google::Cloud::Translate::V3::TranslateDocumentRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) - # Pass arguments to `translate_document` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # 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 source_language_code [::String] - # Optional. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). 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 target_language_code [::String] - # Required. The ISO-639 language code to use for translation of the input - # document, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash] - # Required. Input configurations. - # @param document_output_config [::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash] - # 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 model [::String] - # 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 glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] - # 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 labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters (Unicode - # codepoints), can only contain lowercase letters, numeric characters, - # underscores and dashes. International characters are allowed. Label values - # are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @param customized_attribution [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @param is_translate_native_pdf_only [::Boolean] - # Optional. is_translate_native_pdf_only field for external customers. - # If true, the page limit of online native pdf translation is 300 and only - # native pdf pages will be translated. - # @param enable_shadow_removal_native_pdf [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @param enable_rotation_correction [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new - # - # # Call the translate_document method. - # result = client.translate_document request - # - # # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. - # p result - # - def translate_document request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateDocumentRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.translate_document.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.translate_document.timeout, - metadata: metadata, - retry_policy: @config.rpcs.translate_document.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :translate_document, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # 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 - # 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. - # - # @overload batch_translate_text(request, options = nil) - # Pass arguments to `batch_translate_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::BatchTranslateTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) - # Pass arguments to `batch_translate_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Location to make a call. Must refer to a caller's project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # - # The `global` location is not supported for batch translation. - # - # Only AutoML Translation models or glossaries within the same region (have - # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - # error is returned. - # @param source_language_code [::String] - # Required. Source language code. Supported language codes are listed in - # [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param target_language_codes [::Array<::String>] - # Required. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param models [::Hash{::String => ::String}] - # Optional. The models to use for translation. Map's key is target language - # code. Map's value is model name. Value can be a built-in general model, - # or an AutoML Translation model. - # - # The value format depends on model type: - # - # - AutoML Translation models: - # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - # - # - General (built-in) models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - # - # - # If the map is empty or a specific model is - # not requested for a language pair, then default google model (nmt) is used. - # @param input_configs [::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>] - # Required. Input configurations. - # The total number of files matched should be <= 100. - # The total content size should be <= 100M Unicode codepoints. - # The files must use UTF-8 encoding. - # @param output_config [::Google::Cloud::Translate::V3::OutputConfig, ::Hash] - # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] - # Optional. Glossaries to be applied for translation. - # It's keyed by target language code. - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new - # - # # Call the batch_translate_text method. - # result = client.batch_translate_text request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def batch_translate_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.batch_translate_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.batch_translate_text.timeout, - metadata: metadata, - retry_policy: @config.rpcs.batch_translate_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :batch_translate_text, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # 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. - # - # @overload batch_translate_document(request, options = nil) - # Pass arguments to `batch_translate_document` via a request object, either of type - # {::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) - # Pass arguments to `batch_translate_document` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # 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 source_language_code [::String] - # Required. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). - # @param target_language_codes [::Array<::String>] - # Required. The ISO-639 language code to use for translation of the input - # document. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>] - # 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 output_config [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig, ::Hash] - # 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 models [::Hash{::String => ::String}] - # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] - # Optional. Glossaries to be applied. It's keyed by target language code. - # @param format_conversions [::Hash{::String => ::String}] - # Optional. The file format conversion map that is applied to all input - # files. The map key is the original mime_type. The map 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 customized_attribution [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @param enable_shadow_removal_native_pdf [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @param enable_rotation_correction [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new - # - # # Call the batch_translate_document method. - # result = client.batch_translate_document request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def batch_translate_document request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.batch_translate_document.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.batch_translate_document.timeout, - metadata: metadata, - retry_policy: @config.rpcs.batch_translate_document.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :batch_translate_document, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a glossary and returns the long-running operation. Returns - # NOT_FOUND, if the project doesn't exist. - # - # @overload create_glossary(request, options = nil) - # Pass arguments to `create_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_glossary(parent: nil, glossary: nil) - # Pass arguments to `create_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name. - # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] - # Required. The glossary to create. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new - # - # # Call the create_glossary method. - # result = client.create_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_glossary.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :create_glossary, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a glossary. A LRO is used since the update can be async if the - # glossary's entry file is updated. - # - # @overload update_glossary(request, options = nil) - # Pass arguments to `update_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_glossary(glossary: nil, update_mask: nil) - # Pass arguments to `update_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] - # Required. The glossary entry to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # The list of fields to be updated. Currently only `display_name` and - # 'input_config' - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new - # - # # Call the update_glossary method. - # result = client.update_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def update_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.glossary&.name - header_params["glossary.name"] = request.glossary.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_glossary.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :update_glossary, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - # exist. - # - # @overload list_glossaries(request, options = nil) - # Pass arguments to `list_glossaries` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListGlossariesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_glossaries` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The name of the project from which to list all of the glossaries. - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer glossaries than - # requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of [ListGlossariesResponse.next_page_token] - # returned from the previous call to `ListGlossaries` method. - # The first page is returned if `page_token`is empty or missing. - # @param filter [::String] - # Optional. Filter specifying constraints of a list operation. - # 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. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListGlossariesRequest.new - # - # # Call the list_glossaries method. - # result = client.list_glossaries request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Glossary. - # p item - # end - # - def list_glossaries request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossariesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_glossaries.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_glossaries.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_glossaries.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_glossaries, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossaries, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - # exist. - # - # @overload get_glossary(request, options = nil) - # Pass arguments to `get_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_glossary(name: nil) - # Pass arguments to `get_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the glossary to retrieve. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::Glossary] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::Glossary] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetGlossaryRequest.new - # - # # Call the get_glossary method. - # result = client.get_glossary request - # - # # The returned object is of type Google::Cloud::Translate::V3::Glossary. - # p result - # - def get_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_glossary.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_glossary, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a glossary, or cancels glossary construction - # if the glossary isn't created yet. - # Returns NOT_FOUND, if the glossary doesn't exist. - # - # @overload delete_glossary(request, options = nil) - # Pass arguments to `delete_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_glossary(name: nil) - # Pass arguments to `delete_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the glossary to delete. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new - # - # # Call the delete_glossary method. - # result = client.delete_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_glossary.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_glossary, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a single glossary entry by the given id. - # - # @overload get_glossary_entry(request, options = nil) - # Pass arguments to `get_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_glossary_entry(name: nil) - # Pass arguments to `get_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the glossary entry to get - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new - # - # # Call the get_glossary_entry method. - # result = client.get_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def get_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_glossary_entry, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # List the entries for the glossary. - # - # @overload list_glossary_entries(request, options = nil) - # Pass arguments to `list_glossary_entries` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_glossary_entries` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent glossary resource name for listing the glossary's - # entries. - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer glossary entries - # than requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # [ListGlossaryEntriesResponse.next_page_token] returned from the previous - # call. The first page is returned if `page_token`is empty or missing. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new - # - # # Call the list_glossary_entries method. - # result = client.list_glossary_entries request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. - # p item - # end - # - def list_glossary_entries request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_glossary_entries.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_glossary_entries.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_glossary_entries, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a glossary entry. - # - # @overload create_glossary_entry(request, options = nil) - # Pass arguments to `create_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_glossary_entry(parent: nil, glossary_entry: nil) - # Pass arguments to `create_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the glossary to create the entry under. - # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] - # Required. The glossary entry to create - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new - # - # # Call the create_glossary_entry method. - # result = client.create_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def create_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :create_glossary_entry, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a glossary entry. - # - # @overload update_glossary_entry(request, options = nil) - # Pass arguments to `update_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_glossary_entry(glossary_entry: nil) - # Pass arguments to `update_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] - # Required. The glossary entry to update. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new - # - # # Call the update_glossary_entry method. - # result = client.update_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def update_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.glossary_entry&.name - header_params["glossary_entry.name"] = request.glossary_entry.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :update_glossary_entry, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a single entry from the glossary - # - # @overload delete_glossary_entry(request, options = nil) - # Pass arguments to `delete_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_glossary_entry(name: nil) - # Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the glossary entry to delete - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new - # - # # Call the delete_glossary_entry method. - # result = client.delete_glossary_entry request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_glossary_entry, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a Dataset. - # - # @overload create_dataset(request, options = nil) - # Pass arguments to `create_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_dataset(parent: nil, dataset: nil) - # Pass arguments to `create_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name. - # @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash] - # Required. The Dataset to create. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateDatasetRequest.new - # - # # Call the create_dataset method. - # result = client.create_dataset request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :create_dataset, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a Dataset. - # - # @overload get_dataset(request, options = nil) - # Pass arguments to `get_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_dataset(name: nil) - # Pass arguments to `get_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the dataset to retrieve. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::Dataset] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::Dataset] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetDatasetRequest.new - # - # # Call the get_dataset method. - # result = client.get_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::Dataset. - # p result - # - def get_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_dataset, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists datasets. - # - # @overload list_datasets(request, options = nil) - # Pass arguments to `list_datasets` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_datasets(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_datasets` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListDatasets call. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListDatasetsRequest.new - # - # # Call the list_datasets method. - # result = client.list_datasets request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Dataset. - # p item - # end - # - def list_datasets request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_datasets.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_datasets.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_datasets.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_datasets, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_datasets, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a dataset and all of its contents. - # - # @overload delete_dataset(request, options = nil) - # Pass arguments to `delete_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_dataset(name: nil) - # Pass arguments to `delete_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the dataset to delete. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new - # - # # Call the delete_dataset method. - # result = client.delete_dataset request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_dataset, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates an Adaptive MT dataset. - # - # @overload create_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) - # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash] - # Required. The AdaptiveMtDataset to be created. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new - # - # # Call the create_adaptive_mt_dataset method. - # result = client.create_adaptive_mt_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p result - # - def create_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an Adaptive MT dataset, including all its entries and associated - # metadata. - # - # @overload delete_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_adaptive_mt_dataset(name: nil) - # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new - # - # # Call the delete_adaptive_mt_dataset method. - # result = client.delete_adaptive_mt_dataset request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the Adaptive MT dataset. - # - # @overload get_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_adaptive_mt_dataset(name: nil) - # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new - # - # # Call the get_adaptive_mt_dataset method. - # result = client.get_adaptive_mt_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p result - # - def get_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all Adaptive MT datasets for which the caller has read permission. - # - # @overload list_adaptive_mt_datasets(request, options = nil) - # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer results than - # requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtDatasetsResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtDatasets` method. The first page is - # returned if `page_token`is empty or missing. - # @param filter [::String] - # Optional. An expression for filtering the results of the request. - # Filter is not supported yet. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new - # - # # Call the list_adaptive_mt_datasets method. - # result = client.list_adaptive_mt_datasets request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p item - # end - # - def list_adaptive_mt_datasets request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Translate text using Adaptive MT. - # - # @overload adaptive_mt_translate(request, options = nil) - # Pass arguments to `adaptive_mt_translate` via a request object, either of type - # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) - # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Location to make a regional call. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # @param dataset [::String] - # Required. The resource name for the dataset to use for adaptive MT. - # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` - # @param content [::Array<::String>] - # Required. The content of the input in string format. - # @param mime_type [::String] - # The format of the source text. - # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] - # Configuration for caller provided reference sentences. - # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] - # 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. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new - # - # # Call the adaptive_mt_translate method. - # result = client.adaptive_mt_translate request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. - # p result - # - def adaptive_mt_translate request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout, - metadata: metadata, - retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets and AdaptiveMtFile - # - # @overload get_adaptive_mt_file(request, options = nil) - # Pass arguments to `get_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_adaptive_mt_file(name: nil) - # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new - # - # # Call the get_adaptive_mt_file method. - # result = client.get_adaptive_mt_file request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. - # p result - # - def get_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an AdaptiveMtFile along with its sentences. - # - # @overload delete_adaptive_mt_file(request, options = nil) - # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_adaptive_mt_file(name: nil) - # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the file to delete, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new - # - # # Call the delete_adaptive_mt_file method. - # result = client.delete_adaptive_mt_file request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Imports an AdaptiveMtFile and adds all of its sentences into the - # AdaptiveMtDataset. - # - # @overload import_adaptive_mt_file(request, options = nil) - # Pass arguments to `import_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) - # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` - # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash] - # Inline file source. - # - # Note: The following parameters are mutually exclusive: `file_input_source`, `gcs_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. - # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash] - # Google Cloud Storage file source. - # - # Note: The following parameters are mutually exclusive: `gcs_input_source`, `file_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new - # - # # Call the import_adaptive_mt_file method. - # result = client.import_adaptive_mt_file request - # - # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. - # p result - # - def import_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout, - metadata: metadata, - retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. - # - # @overload list_adaptive_mt_files(request, options = nil) - # Pass arguments to `list_adaptive_mt_files` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @param page_size [::Integer] - # Optional. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtFilesResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtFiles` method. The first page is - # returned if `page_token`is empty or missing. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new - # - # # Call the list_adaptive_mt_files method. - # result = client.list_adaptive_mt_files request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. - # p item - # end - # - def list_adaptive_mt_files request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all AdaptiveMtSentences under a given file/dataset. - # - # @overload list_adaptive_mt_sentences(request, options = nil) - # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. The following format lists all sentences under a file. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # The following format lists all sentences within a dataset. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @param page_size [::Integer] - # @param page_token [::String] - # A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtSentencesRequest.next_page_token returned from the - # previous call to `ListTranslationMemories` method. The first page is - # returned if `page_token` is empty or missing. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new - # - # # Call the list_adaptive_mt_sentences method. - # result = client.list_adaptive_mt_sentences request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. - # p item - # end - # - def list_adaptive_mt_sentences request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Import sentence pairs into translation Dataset. - # - # @overload import_data(request, options = nil) - # Pass arguments to `import_data` via a request object, either of type - # {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload import_data(dataset: nil, input_config: nil) - # Pass arguments to `import_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param dataset [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash] - # Required. The config for the input content. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ImportDataRequest.new - # - # # Call the import_data method. - # result = client.import_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.import_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.dataset - header_params["dataset"] = request.dataset - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.import_data.timeout, - metadata: metadata, - retry_policy: @config.rpcs.import_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :import_data, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Exports dataset's data to the provided output location. - # - # @overload export_data(request, options = nil) - # Pass arguments to `export_data` via a request object, either of type - # {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload export_data(dataset: nil, output_config: nil) - # Pass arguments to `export_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param dataset [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash] - # Required. The config for the output content. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ExportDataRequest.new - # - # # Call the export_data method. - # result = client.export_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def export_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.export_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.dataset - header_params["dataset"] = request.dataset - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.export_data.timeout, - metadata: metadata, - retry_policy: @config.rpcs.export_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :export_data, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists sentence pairs in the dataset. - # - # @overload list_examples(request, options = nil) - # Pass arguments to `list_examples` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_examples` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param filter [::String] - # Optional. An expression for filtering the examples that will be returned. - # Example filter: - # * `usage=TRAIN` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListExamples call. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListExamplesRequest.new - # - # # Call the list_examples method. - # result = client.list_examples request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Example. - # p item - # end - # - def list_examples request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_examples.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_examples.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_examples.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_examples, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_examples, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a Model. - # - # @overload create_model(request, options = nil) - # Pass arguments to `create_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_model(parent: nil, model: nil) - # Pass arguments to `create_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name, in form of - # `projects/{project}/locations/{location}` - # @param model [::Google::Cloud::Translate::V3::Model, ::Hash] - # Required. The Model to create. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateModelRequest.new - # - # # Call the create_model method. - # result = client.create_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :create_model, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists models. - # - # @overload list_models(request, options = nil) - # Pass arguments to `list_models` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_models` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param filter [::String] - # Optional. An expression for filtering the models that will be returned. - # Supported filter: - # `dataset_id=${dataset_id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListModels call. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListModelsRequest.new - # - # # Call the list_models method. - # result = client.list_models request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Model. - # p item - # end - # - def list_models request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_models.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_models.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_models.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :list_models, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_models, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a model. - # - # @overload get_model(request, options = nil) - # Pass arguments to `get_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_model(name: nil) - # Pass arguments to `get_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the model to retrieve. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Translate::V3::Model] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Translate::V3::Model] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetModelRequest.new - # - # # Call the get_model method. - # result = client.get_model request - # - # # The returned object is of type Google::Cloud::Translate::V3::Model. - # p result - # - def get_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :get_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a model. - # - # @overload delete_model(request, options = nil) - # Pass arguments to `delete_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_model(name: nil) - # Pass arguments to `delete_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to delete. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteModelRequest.new - # - # # Call the delete_model method. - # result = client.delete_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.call_rpc :delete_model, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the TranslationService API. - # - # This class represents the configuration for TranslationService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # translate_text to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.translate_text.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.translate_text.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "translate.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the TranslationService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `translate_text` - # @return [::Gapic::Config::Method] - # - attr_reader :translate_text - ## - # RPC-specific configuration for `romanize_text` - # @return [::Gapic::Config::Method] - # - attr_reader :romanize_text - ## - # RPC-specific configuration for `detect_language` - # @return [::Gapic::Config::Method] - # - attr_reader :detect_language - ## - # RPC-specific configuration for `get_supported_languages` - # @return [::Gapic::Config::Method] - # - attr_reader :get_supported_languages - ## - # RPC-specific configuration for `translate_document` - # @return [::Gapic::Config::Method] - # - attr_reader :translate_document - ## - # RPC-specific configuration for `batch_translate_text` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_translate_text - ## - # RPC-specific configuration for `batch_translate_document` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_translate_document - ## - # RPC-specific configuration for `create_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :create_glossary - ## - # RPC-specific configuration for `update_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :update_glossary - ## - # RPC-specific configuration for `list_glossaries` - # @return [::Gapic::Config::Method] - # - attr_reader :list_glossaries - ## - # RPC-specific configuration for `get_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :get_glossary - ## - # RPC-specific configuration for `delete_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_glossary - ## - # RPC-specific configuration for `get_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :get_glossary_entry - ## - # RPC-specific configuration for `list_glossary_entries` - # @return [::Gapic::Config::Method] - # - attr_reader :list_glossary_entries - ## - # RPC-specific configuration for `create_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :create_glossary_entry - ## - # RPC-specific configuration for `update_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :update_glossary_entry - ## - # RPC-specific configuration for `delete_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_glossary_entry - ## - # RPC-specific configuration for `create_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :create_dataset - ## - # RPC-specific configuration for `get_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :get_dataset - ## - # RPC-specific configuration for `list_datasets` - # @return [::Gapic::Config::Method] - # - attr_reader :list_datasets - ## - # RPC-specific configuration for `delete_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_dataset - ## - # RPC-specific configuration for `create_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :create_adaptive_mt_dataset - ## - # RPC-specific configuration for `delete_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_adaptive_mt_dataset - ## - # RPC-specific configuration for `get_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :get_adaptive_mt_dataset - ## - # RPC-specific configuration for `list_adaptive_mt_datasets` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_datasets - ## - # RPC-specific configuration for `adaptive_mt_translate` - # @return [::Gapic::Config::Method] - # - attr_reader :adaptive_mt_translate - ## - # RPC-specific configuration for `get_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :get_adaptive_mt_file - ## - # RPC-specific configuration for `delete_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_adaptive_mt_file - ## - # RPC-specific configuration for `import_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :import_adaptive_mt_file - ## - # RPC-specific configuration for `list_adaptive_mt_files` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_files - ## - # RPC-specific configuration for `list_adaptive_mt_sentences` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_sentences - ## - # RPC-specific configuration for `import_data` - # @return [::Gapic::Config::Method] - # - attr_reader :import_data - ## - # RPC-specific configuration for `export_data` - # @return [::Gapic::Config::Method] - # - attr_reader :export_data - ## - # RPC-specific configuration for `list_examples` - # @return [::Gapic::Config::Method] - # - attr_reader :list_examples - ## - # RPC-specific configuration for `create_model` - # @return [::Gapic::Config::Method] - # - attr_reader :create_model - ## - # RPC-specific configuration for `list_models` - # @return [::Gapic::Config::Method] - # - attr_reader :list_models - ## - # RPC-specific configuration for `get_model` - # @return [::Gapic::Config::Method] - # - attr_reader :get_model - ## - # RPC-specific configuration for `delete_model` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_model - - # @private - def initialize parent_rpcs = nil - translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text - @translate_text = ::Gapic::Config::Method.new translate_text_config - romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text - @romanize_text = ::Gapic::Config::Method.new romanize_text_config - detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language - @detect_language = ::Gapic::Config::Method.new detect_language_config - get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages - @get_supported_languages = ::Gapic::Config::Method.new get_supported_languages_config - translate_document_config = parent_rpcs.translate_document if parent_rpcs.respond_to? :translate_document - @translate_document = ::Gapic::Config::Method.new translate_document_config - batch_translate_text_config = parent_rpcs.batch_translate_text if parent_rpcs.respond_to? :batch_translate_text - @batch_translate_text = ::Gapic::Config::Method.new batch_translate_text_config - batch_translate_document_config = parent_rpcs.batch_translate_document if parent_rpcs.respond_to? :batch_translate_document - @batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config - create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary - @create_glossary = ::Gapic::Config::Method.new create_glossary_config - update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary - @update_glossary = ::Gapic::Config::Method.new update_glossary_config - list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries - @list_glossaries = ::Gapic::Config::Method.new list_glossaries_config - get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary - @get_glossary = ::Gapic::Config::Method.new get_glossary_config - delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary - @delete_glossary = ::Gapic::Config::Method.new delete_glossary_config - get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry - @get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config - list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries - @list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config - create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry - @create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config - update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry - @update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config - delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry - @delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config - create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset - @create_dataset = ::Gapic::Config::Method.new create_dataset_config - get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset - @get_dataset = ::Gapic::Config::Method.new get_dataset_config - list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets - @list_datasets = ::Gapic::Config::Method.new list_datasets_config - delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset - @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config - create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset - @create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config - delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset - @delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config - get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset - @get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config - list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets - @list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config - adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate - @adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config - get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file - @get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config - delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file - @delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config - import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file - @import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config - list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files - @list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config - list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences - @list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config - import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data - @import_data = ::Gapic::Config::Method.new import_data_config - export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data - @export_data = ::Gapic::Config::Method.new export_data_config - list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples - @list_examples = ::Gapic::Config::Method.new list_examples_config - create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model - @create_model = ::Gapic::Config::Method.new create_model_config - list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models - @list_models = ::Gapic::Config::Method.new list_models_config - get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model - @get_model = ::Gapic::Config::Method.new get_model_config - delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model - @delete_model = ::Gapic::Config::Method.new delete_model_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb deleted file mode 100644 index 8cca11bc3a91..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/credentials.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - # Credentials for the TranslationService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/cloud-translation" - ] - self.env_vars = [ - "TRANSLATE_CREDENTIALS", - "TRANSLATE_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "TRANSLATE_CREDENTIALS_JSON", - "TRANSLATE_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb deleted file mode 100644 index 6bd74364f287..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/operations.rb +++ /dev/null @@ -1,849 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the TranslationService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the TranslationService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "translate.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb deleted file mode 100644 index 1f51c2c96070..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/paths.rb +++ /dev/null @@ -1,168 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - module TranslationService - # Path helper methods for the TranslationService API. - module Paths - ## - # Create a fully-qualified AdaptiveMtDataset resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # - # @param project [String] - # @param location [String] - # @param dataset [String] - # - # @return [::String] - def adaptive_mt_dataset_path project:, location:, dataset: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/adaptiveMtDatasets/#{dataset}" - end - - ## - # Create a fully-qualified AdaptiveMtFile resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # - # @param project [String] - # @param location [String] - # @param dataset [String] - # @param file [String] - # - # @return [::String] - def adaptive_mt_file_path project:, location:, dataset:, file: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/" - - "projects/#{project}/locations/#{location}/adaptiveMtDatasets/#{dataset}/adaptiveMtFiles/#{file}" - end - - ## - # Create a fully-qualified Dataset resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/datasets/{dataset}` - # - # @param project [String] - # @param location [String] - # @param dataset [String] - # - # @return [::String] - def dataset_path project:, location:, dataset: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/datasets/#{dataset}" - end - - ## - # Create a fully-qualified Glossary resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/glossaries/{glossary}` - # - # @param project [String] - # @param location [String] - # @param glossary [String] - # - # @return [::String] - def glossary_path project:, location:, glossary: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/glossaries/#{glossary}" - end - - ## - # Create a fully-qualified GlossaryEntry resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/glossaries/{glossary}/glossaryEntries/{glossary_entry}` - # - # @param project [String] - # @param location [String] - # @param glossary [String] - # @param glossary_entry [String] - # - # @return [::String] - def glossary_entry_path project:, location:, glossary:, glossary_entry: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "glossary cannot contain /" if glossary.to_s.include? "/" - - "projects/#{project}/locations/#{location}/glossaries/#{glossary}/glossaryEntries/#{glossary_entry}" - end - - ## - # Create a fully-qualified Location resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}` - # - # @param project [String] - # @param location [String] - # - # @return [::String] - def location_path project:, location: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - - "projects/#{project}/locations/#{location}" - end - - ## - # Create a fully-qualified Model resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/models/{model}` - # - # @param project [String] - # @param location [String] - # @param model [String] - # - # @return [::String] - def model_path project:, location:, model: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/models/#{model}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb deleted file mode 100644 index 7aa1906ff964..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/translate/v3/version" -require "google/cloud/translate/v3/bindings_override" - -require "google/cloud/translate/v3/translation_service/credentials" -require "google/cloud/translate/v3/translation_service/paths" -require "google/cloud/translate/v3/translation_service/rest/operations" -require "google/cloud/translate/v3/translation_service/rest/client" - -module Google - module Cloud - module Translate - module V3 - ## - # Provides natural language translation operations. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/translate/v3/translation_service/rest" - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - module TranslationService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/translate/v3/translation_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb deleted file mode 100644 index c04f4cf27519..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/client.rb +++ /dev/null @@ -1,4315 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/translate/v3/translation_service_pb" -require "google/cloud/translate/v3/translation_service/rest/service_stub" -require "google/cloud/location/rest" -require "google/iam/v1/rest" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - module Rest - ## - # REST client for the TranslationService service. - # - # Provides natural language translation operations. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :translation_service_stub - - ## - # Configure the TranslationService Client class. - # - # See {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all TranslationService clients - # ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Translate", "V3"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.rpcs.translate_text.timeout = 600.0 - - default_config.rpcs.detect_language.timeout = 600.0 - - default_config.rpcs.get_supported_languages.timeout = 600.0 - default_config.rpcs.get_supported_languages.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.translate_document.timeout = 600.0 - - default_config.rpcs.batch_translate_text.timeout = 600.0 - - default_config.rpcs.batch_translate_document.timeout = 600.0 - - default_config.rpcs.create_glossary.timeout = 600.0 - - default_config.rpcs.list_glossaries.timeout = 600.0 - default_config.rpcs.list_glossaries.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.get_glossary.timeout = 600.0 - default_config.rpcs.get_glossary.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config.rpcs.delete_glossary.timeout = 600.0 - default_config.rpcs.delete_glossary.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the TranslationService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @translation_service_stub.universe_domain - end - - ## - # Create a new TranslationService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the TranslationService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @translation_service_stub = ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @translation_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @translation_service_stub.endpoint - config.universe_domain = @translation_service_stub.universe_domain - config.bindings_override = @config.bindings_override - config.logger = @translation_service_stub.logger if config.respond_to? :logger= - end - - @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @translation_service_stub.endpoint - config.universe_domain = @translation_service_stub.universe_domain - config.logger = @translation_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Translate::V3::TranslationService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # Get the associated client for mix-in of the IAMPolicy. - # - # @return [Google::Iam::V1::IAMPolicy::Rest::Client] - # - attr_reader :iam_policy_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @translation_service_stub.logger - end - - # Service calls - - ## - # Translates input text and returns translated text. - # - # @overload translate_text(request, options = nil) - # Pass arguments to `translate_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::TranslateTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::TranslateTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) - # Pass arguments to `translate_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param contents [::Array<::String>] - # Required. The content of the input in string format. - # We recommend the total content be less than 30,000 codepoints. The max - # length of this field is 1024. Use BatchTranslateText for larger text. - # @param mime_type [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @param source_language_code [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "en-US" or "sr-Latn". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). If the source - # language isn't specified, the API attempts to identify the source language - # automatically and returns the source language within the response. - # @param target_language_code [::String] - # Required. The ISO-639 language code to use for translation of the input - # text, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 same - # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - # @param model [::String] - # 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`, - # - # - Translation LLM models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, - # - # For global (non-regionalized) requests, use `location-id` `global`. - # For example, - # `projects/{project-number-or-id}/locations/global/models/general/nmt`. - # - # If not provided, the default Google model (NMT) will be used - # @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] - # 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 transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash] - # Optional. Transliteration to be applied. - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::TranslateTextResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::TranslateTextRequest.new - # - # # Call the translate_text method. - # result = client.translate_text request - # - # # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. - # p result - # - def translate_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.translate_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.translate_text.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.translate_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.translate_text request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Romanize input text written in non-Latin scripts to Latin text. - # - # @overload romanize_text(request, options = nil) - # Pass arguments to `romanize_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload romanize_text(parent: nil, contents: nil, source_language_code: nil) - # Pass arguments to `romanize_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # @param contents [::Array<::String>] - # Required. The content of the input in string format. - # @param source_language_code [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "hi" or "zh". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages#roman). If the - # source language isn't specified, the API attempts to identify the source - # language automatically and returns the source language for each content in - # the response. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::RomanizeTextRequest.new - # - # # Call the romanize_text method. - # result = client.romanize_text request - # - # # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. - # p result - # - def romanize_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.romanize_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.romanize_text.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.romanize_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.romanize_text request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Detects the language of text within a request. - # - # @overload detect_language(request, options = nil) - # Pass arguments to `detect_language` via a request object, either of type - # {::Google::Cloud::Translate::V3::DetectLanguageRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) - # Pass arguments to `detect_language` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # - # Only models within the same region (has same location-id) can be used. - # Otherwise an INVALID_ARGUMENT (400) error is returned. - # @param model [::String] - # Optional. The language detection model to be used. - # - # Format: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - # - # Only one language detection model is currently supported: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - # - # If not specified, the default model is used. - # @param content [::String] - # The content of the input stored as a string. - # @param mime_type [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DetectLanguageRequest.new - # - # # Call the detect_language method. - # result = client.detect_language request - # - # # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. - # p result - # - def detect_language request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DetectLanguageRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.detect_language.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.detect_language.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.detect_language.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.detect_language request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Returns a list of supported languages for translation. - # - # @overload get_supported_languages(request, options = nil) - # Pass arguments to `get_supported_languages` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_supported_languages(parent: nil, display_language_code: nil, model: nil) - # Pass arguments to `get_supported_languages` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 AutoML models. - # - # Only models within the same region (have same location-id) can be used, - # otherwise an INVALID_ARGUMENT (400) error is returned. - # @param display_language_code [::String] - # Optional. The language to use to return localized, human readable names - # of supported languages. If missing, then display names are not returned - # in a response. - # @param model [::String] - # Optional. Get supported languages of this model. - # - # 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`, - # - # - # Returns languages supported by the specified model. - # If missing, we get supported languages of Google general NMT model. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::SupportedLanguages] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::SupportedLanguages] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new - # - # # Call the get_supported_languages method. - # result = client.get_supported_languages request - # - # # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. - # p result - # - def get_supported_languages request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_supported_languages.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_supported_languages.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_supported_languages.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_supported_languages request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Translates documents in synchronous mode. - # - # @overload translate_document(request, options = nil) - # Pass arguments to `translate_document` via a request object, either of type - # {::Google::Cloud::Translate::V3::TranslateDocumentRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) - # Pass arguments to `translate_document` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # 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 source_language_code [::String] - # Optional. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). 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 target_language_code [::String] - # Required. The ISO-639 language code to use for translation of the input - # document, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash] - # Required. Input configurations. - # @param document_output_config [::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash] - # 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 model [::String] - # 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 glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash] - # 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 labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters (Unicode - # codepoints), can only contain lowercase letters, numeric characters, - # underscores and dashes. International characters are allowed. Label values - # are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @param customized_attribution [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @param is_translate_native_pdf_only [::Boolean] - # Optional. is_translate_native_pdf_only field for external customers. - # If true, the page limit of online native pdf translation is 300 and only - # native pdf pages will be translated. - # @param enable_shadow_removal_native_pdf [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @param enable_rotation_correction [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new - # - # # Call the translate_document method. - # result = client.translate_document request - # - # # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. - # p result - # - def translate_document request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateDocumentRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.translate_document.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.translate_document.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.translate_document.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.translate_document request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # 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 - # 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. - # - # @overload batch_translate_text(request, options = nil) - # Pass arguments to `batch_translate_text` via a request object, either of type - # {::Google::Cloud::Translate::V3::BatchTranslateTextRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) - # Pass arguments to `batch_translate_text` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Location to make a call. Must refer to a caller's project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # - # The `global` location is not supported for batch translation. - # - # Only AutoML Translation models or glossaries within the same region (have - # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - # error is returned. - # @param source_language_code [::String] - # Required. Source language code. Supported language codes are listed in - # [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param target_language_codes [::Array<::String>] - # Required. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param models [::Hash{::String => ::String}] - # Optional. The models to use for translation. Map's key is target language - # code. Map's value is model name. Value can be a built-in general model, - # or an AutoML Translation model. - # - # The value format depends on model type: - # - # - AutoML Translation models: - # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - # - # - General (built-in) models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - # - # - # If the map is empty or a specific model is - # not requested for a language pair, then default google model (nmt) is used. - # @param input_configs [::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>] - # Required. Input configurations. - # The total number of files matched should be <= 100. - # The total content size should be <= 100M Unicode codepoints. - # The files must use UTF-8 encoding. - # @param output_config [::Google::Cloud::Translate::V3::OutputConfig, ::Hash] - # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] - # Optional. Glossaries to be applied for translation. - # It's keyed by target language code. - # @param labels [::Hash{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new - # - # # Call the batch_translate_text method. - # result = client.batch_translate_text request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def batch_translate_text request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateTextRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.batch_translate_text.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.batch_translate_text.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.batch_translate_text.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.batch_translate_text request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # 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. - # - # @overload batch_translate_document(request, options = nil) - # Pass arguments to `batch_translate_document` via a request object, either of type - # {::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) - # Pass arguments to `batch_translate_document` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # 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 source_language_code [::String] - # Required. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). - # @param target_language_codes [::Array<::String>] - # Required. The ISO-639 language code to use for translation of the input - # document. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>] - # 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 output_config [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig, ::Hash] - # 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 models [::Hash{::String => ::String}] - # 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 glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}] - # Optional. Glossaries to be applied. It's keyed by target language code. - # @param format_conversions [::Hash{::String => ::String}] - # Optional. The file format conversion map that is applied to all input - # files. The map key is the original mime_type. The map 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 customized_attribution [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @param enable_shadow_removal_native_pdf [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @param enable_rotation_correction [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new - # - # # Call the batch_translate_document method. - # result = client.batch_translate_document request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def batch_translate_document request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.batch_translate_document.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.batch_translate_document.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.batch_translate_document.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.batch_translate_document request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a glossary and returns the long-running operation. Returns - # NOT_FOUND, if the project doesn't exist. - # - # @overload create_glossary(request, options = nil) - # Pass arguments to `create_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_glossary(parent: nil, glossary: nil) - # Pass arguments to `create_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name. - # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] - # Required. The glossary to create. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new - # - # # Call the create_glossary method. - # result = client.create_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_glossary.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.create_glossary request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a glossary. A LRO is used since the update can be async if the - # glossary's entry file is updated. - # - # @overload update_glossary(request, options = nil) - # Pass arguments to `update_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_glossary(glossary: nil, update_mask: nil) - # Pass arguments to `update_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash] - # Required. The glossary entry to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # The list of fields to be updated. Currently only `display_name` and - # 'input_config' - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new - # - # # Call the update_glossary method. - # result = client.update_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def update_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_glossary.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.update_glossary request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - # exist. - # - # @overload list_glossaries(request, options = nil) - # Pass arguments to `list_glossaries` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListGlossariesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_glossaries` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The name of the project from which to list all of the glossaries. - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer glossaries than - # requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of [ListGlossariesResponse.next_page_token] - # returned from the previous call to `ListGlossaries` method. - # The first page is returned if `page_token`is empty or missing. - # @param filter [::String] - # Optional. Filter specifying constraints of a list operation. - # 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. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListGlossariesRequest.new - # - # # Call the list_glossaries method. - # result = client.list_glossaries request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Glossary. - # p item - # end - # - def list_glossaries request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossariesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_glossaries.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_glossaries.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_glossaries.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_glossaries request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossaries, "glossaries", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - # exist. - # - # @overload get_glossary(request, options = nil) - # Pass arguments to `get_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_glossary(name: nil) - # Pass arguments to `get_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the glossary to retrieve. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Glossary] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Glossary] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetGlossaryRequest.new - # - # # Call the get_glossary method. - # result = client.get_glossary request - # - # # The returned object is of type Google::Cloud::Translate::V3::Glossary. - # p result - # - def get_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_glossary.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_glossary request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a glossary, or cancels glossary construction - # if the glossary isn't created yet. - # Returns NOT_FOUND, if the glossary doesn't exist. - # - # @overload delete_glossary(request, options = nil) - # Pass arguments to `delete_glossary` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteGlossaryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_glossary(name: nil) - # Pass arguments to `delete_glossary` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the glossary to delete. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new - # - # # Call the delete_glossary method. - # result = client.delete_glossary request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_glossary request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_glossary.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_glossary.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_glossary.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_glossary request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a single glossary entry by the given id. - # - # @overload get_glossary_entry(request, options = nil) - # Pass arguments to `get_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_glossary_entry(name: nil) - # Pass arguments to `get_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the glossary entry to get - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new - # - # # Call the get_glossary_entry method. - # result = client.get_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def get_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_glossary_entry request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # List the entries for the glossary. - # - # @overload list_glossary_entries(request, options = nil) - # Pass arguments to `list_glossary_entries` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_glossary_entries` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent glossary resource name for listing the glossary's - # entries. - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer glossary entries - # than requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # [ListGlossaryEntriesResponse.next_page_token] returned from the previous - # call. The first page is returned if `page_token`is empty or missing. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new - # - # # Call the list_glossary_entries method. - # result = client.list_glossary_entries request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. - # p item - # end - # - def list_glossary_entries request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_glossary_entries.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_glossary_entries.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_glossary_entries request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, "glossary_entries", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a glossary entry. - # - # @overload create_glossary_entry(request, options = nil) - # Pass arguments to `create_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_glossary_entry(parent: nil, glossary_entry: nil) - # Pass arguments to `create_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the glossary to create the entry under. - # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] - # Required. The glossary entry to create - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new - # - # # Call the create_glossary_entry method. - # result = client.create_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def create_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.create_glossary_entry request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a glossary entry. - # - # @overload update_glossary_entry(request, options = nil) - # Pass arguments to `update_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_glossary_entry(glossary_entry: nil) - # Pass arguments to `update_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash] - # Required. The glossary entry to update. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new - # - # # Call the update_glossary_entry method. - # result = client.update_glossary_entry request - # - # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - # p result - # - def update_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.update_glossary_entry request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a single entry from the glossary - # - # @overload delete_glossary_entry(request, options = nil) - # Pass arguments to `delete_glossary_entry` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_glossary_entry(name: nil) - # Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the glossary entry to delete - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new - # - # # Call the delete_glossary_entry method. - # result = client.delete_glossary_entry request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_glossary_entry request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_glossary_entry.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_glossary_entry.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_glossary_entry request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a Dataset. - # - # @overload create_dataset(request, options = nil) - # Pass arguments to `create_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_dataset(parent: nil, dataset: nil) - # Pass arguments to `create_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name. - # @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash] - # Required. The Dataset to create. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateDatasetRequest.new - # - # # Call the create_dataset method. - # result = client.create_dataset request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.create_dataset request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a Dataset. - # - # @overload get_dataset(request, options = nil) - # Pass arguments to `get_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_dataset(name: nil) - # Pass arguments to `get_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the dataset to retrieve. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Dataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Dataset] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetDatasetRequest.new - # - # # Call the get_dataset method. - # result = client.get_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::Dataset. - # p result - # - def get_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_dataset request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists datasets. - # - # @overload list_datasets(request, options = nil) - # Pass arguments to `list_datasets` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_datasets(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_datasets` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListDatasets call. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListDatasetsRequest.new - # - # # Call the list_datasets method. - # result = client.list_datasets request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Dataset. - # p item - # end - # - def list_datasets request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_datasets.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_datasets.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_datasets.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_datasets request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_datasets, "datasets", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a dataset and all of its contents. - # - # @overload delete_dataset(request, options = nil) - # Pass arguments to `delete_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_dataset(name: nil) - # Pass arguments to `delete_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the dataset to delete. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new - # - # # Call the delete_dataset method. - # result = client.delete_dataset request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_dataset request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates an Adaptive MT dataset. - # - # @overload create_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) - # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash] - # Required. The AdaptiveMtDataset to be created. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new - # - # # Call the create_adaptive_mt_dataset method. - # result = client.create_adaptive_mt_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p result - # - def create_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an Adaptive MT dataset, including all its entries and associated - # metadata. - # - # @overload delete_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_adaptive_mt_dataset(name: nil) - # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new - # - # # Call the delete_adaptive_mt_dataset method. - # result = client.delete_adaptive_mt_dataset request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the Adaptive MT dataset. - # - # @overload get_adaptive_mt_dataset(request, options = nil) - # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_adaptive_mt_dataset(name: nil) - # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new - # - # # Call the get_adaptive_mt_dataset method. - # result = client.get_adaptive_mt_dataset request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p result - # - def get_adaptive_mt_dataset request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all Adaptive MT datasets for which the caller has read permission. - # - # @overload list_adaptive_mt_datasets(request, options = nil) - # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server may return fewer results than - # requested. If unspecified, the server picks an appropriate default. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtDatasetsResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtDatasets` method. The first page is - # returned if `page_token`is empty or missing. - # @param filter [::String] - # Optional. An expression for filtering the results of the request. - # Filter is not supported yet. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new - # - # # Call the list_adaptive_mt_datasets method. - # result = client.list_adaptive_mt_datasets request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. - # p item - # end - # - def list_adaptive_mt_datasets request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Translate text using Adaptive MT. - # - # @overload adaptive_mt_translate(request, options = nil) - # Pass arguments to `adaptive_mt_translate` via a request object, either of type - # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, mime_type: nil, reference_sentence_config: nil, glossary_config: nil) - # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Location to make a regional call. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # @param dataset [::String] - # Required. The resource name for the dataset to use for adaptive MT. - # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` - # @param content [::Array<::String>] - # Required. The content of the input in string format. - # @param mime_type [::String] - # The format of the source text. - # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash] - # Configuration for caller provided reference sentences. - # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash] - # 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. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new - # - # # Call the adaptive_mt_translate method. - # result = client.adaptive_mt_translate request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. - # p result - # - def adaptive_mt_translate request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.adaptive_mt_translate request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets and AdaptiveMtFile - # - # @overload get_adaptive_mt_file(request, options = nil) - # Pass arguments to `get_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_adaptive_mt_file(name: nil) - # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new - # - # # Call the get_adaptive_mt_file method. - # result = client.get_adaptive_mt_file request - # - # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. - # p result - # - def get_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_adaptive_mt_file request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an AdaptiveMtFile along with its sentences. - # - # @overload delete_adaptive_mt_file(request, options = nil) - # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_adaptive_mt_file(name: nil) - # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the file to delete, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new - # - # # Call the delete_adaptive_mt_file method. - # result = client.delete_adaptive_mt_file request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_adaptive_mt_file request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Imports an AdaptiveMtFile and adds all of its sentences into the - # AdaptiveMtDataset. - # - # @overload import_adaptive_mt_file(request, options = nil) - # Pass arguments to `import_adaptive_mt_file` via a request object, either of type - # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) - # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` - # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash] - # Inline file source. - # - # Note: The following parameters are mutually exclusive: `file_input_source`, `gcs_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. - # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash] - # Google Cloud Storage file source. - # - # Note: The following parameters are mutually exclusive: `gcs_input_source`, `file_input_source`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new - # - # # Call the import_adaptive_mt_file method. - # result = client.import_adaptive_mt_file request - # - # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. - # p result - # - def import_adaptive_mt_file request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.import_adaptive_mt_file request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. - # - # @overload list_adaptive_mt_files(request, options = nil) - # Pass arguments to `list_adaptive_mt_files` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @param page_size [::Integer] - # Optional. - # @param page_token [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtFilesResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtFiles` method. The first page is - # returned if `page_token`is empty or missing. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new - # - # # Call the list_adaptive_mt_files method. - # result = client.list_adaptive_mt_files request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. - # p item - # end - # - def list_adaptive_mt_files request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_adaptive_mt_files request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all AdaptiveMtSentences under a given file/dataset. - # - # @overload list_adaptive_mt_sentences(request, options = nil) - # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. The following format lists all sentences under a file. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # The following format lists all sentences within a dataset. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @param page_size [::Integer] - # @param page_token [::String] - # A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtSentencesRequest.next_page_token returned from the - # previous call to `ListTranslationMemories` method. The first page is - # returned if `page_token` is empty or missing. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new - # - # # Call the list_adaptive_mt_sentences method. - # result = client.list_adaptive_mt_sentences request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. - # p item - # end - # - def list_adaptive_mt_sentences request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Import sentence pairs into translation Dataset. - # - # @overload import_data(request, options = nil) - # Pass arguments to `import_data` via a request object, either of type - # {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload import_data(dataset: nil, input_config: nil) - # Pass arguments to `import_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param dataset [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash] - # Required. The config for the input content. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ImportDataRequest.new - # - # # Call the import_data method. - # result = client.import_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.import_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.import_data.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.import_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.import_data request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Exports dataset's data to the provided output location. - # - # @overload export_data(request, options = nil) - # Pass arguments to `export_data` via a request object, either of type - # {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload export_data(dataset: nil, output_config: nil) - # Pass arguments to `export_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param dataset [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash] - # Required. The config for the output content. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ExportDataRequest.new - # - # # Call the export_data method. - # result = client.export_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def export_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.export_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.export_data.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.export_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.export_data request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists sentence pairs in the dataset. - # - # @overload list_examples(request, options = nil) - # Pass arguments to `list_examples` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_examples` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @param filter [::String] - # Optional. An expression for filtering the examples that will be returned. - # Example filter: - # * `usage=TRAIN` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListExamples call. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListExamplesRequest.new - # - # # Call the list_examples method. - # result = client.list_examples request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Example. - # p item - # end - # - def list_examples request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_examples.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_examples.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_examples.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_examples request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_examples, "examples", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Creates a Model. - # - # @overload create_model(request, options = nil) - # Pass arguments to `create_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_model(parent: nil, model: nil) - # Pass arguments to `create_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The project name, in form of - # `projects/{project}/locations/{location}` - # @param model [::Google::Cloud::Translate::V3::Model, ::Hash] - # Required. The Model to create. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::CreateModelRequest.new - # - # # Call the create_model method. - # result = client.create_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.create_model request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists models. - # - # @overload list_models(request, options = nil) - # Pass arguments to `list_models` via a request object, either of type - # {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_models` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @param filter [::String] - # Optional. An expression for filtering the models that will be returned. - # Supported filter: - # `dataset_id=${dataset_id}` - # @param page_size [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @param page_token [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListModels call. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::ListModelsRequest.new - # - # # Call the list_models method. - # result = client.list_models request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Translate::V3::Model. - # p item - # end - # - def list_models request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_models.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_models.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_models.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.list_models request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_models, "models", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a model. - # - # @overload get_model(request, options = nil) - # Pass arguments to `get_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_model(name: nil) - # Pass arguments to `get_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the model to retrieve. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Model] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::GetModelRequest.new - # - # # Call the get_model method. - # result = client.get_model request - # - # # The returned object is of type Google::Cloud::Translate::V3::Model. - # p result - # - def get_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.get_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a model. - # - # @overload delete_model(request, options = nil) - # Pass arguments to `delete_model` via a request object, either of type - # {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_model(name: nil) - # Pass arguments to `delete_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to delete. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/translate/v3" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Translate::V3::DeleteModelRequest.new - # - # # Call the delete_model method. - # result = client.delete_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def delete_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @translation_service_stub.delete_model request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the TranslationService REST API. - # - # This class represents the configuration for TranslationService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # translate_text to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.translate_text.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.translate_text.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "translate.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - - # @private - # Overrides for http bindings for the RPCs of this service - # are only used when this service is used as mixin, and only - # by the host service. - # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] - config_attr :bindings_override, {}, ::Hash, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the TranslationService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `translate_text` - # @return [::Gapic::Config::Method] - # - attr_reader :translate_text - ## - # RPC-specific configuration for `romanize_text` - # @return [::Gapic::Config::Method] - # - attr_reader :romanize_text - ## - # RPC-specific configuration for `detect_language` - # @return [::Gapic::Config::Method] - # - attr_reader :detect_language - ## - # RPC-specific configuration for `get_supported_languages` - # @return [::Gapic::Config::Method] - # - attr_reader :get_supported_languages - ## - # RPC-specific configuration for `translate_document` - # @return [::Gapic::Config::Method] - # - attr_reader :translate_document - ## - # RPC-specific configuration for `batch_translate_text` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_translate_text - ## - # RPC-specific configuration for `batch_translate_document` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_translate_document - ## - # RPC-specific configuration for `create_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :create_glossary - ## - # RPC-specific configuration for `update_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :update_glossary - ## - # RPC-specific configuration for `list_glossaries` - # @return [::Gapic::Config::Method] - # - attr_reader :list_glossaries - ## - # RPC-specific configuration for `get_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :get_glossary - ## - # RPC-specific configuration for `delete_glossary` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_glossary - ## - # RPC-specific configuration for `get_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :get_glossary_entry - ## - # RPC-specific configuration for `list_glossary_entries` - # @return [::Gapic::Config::Method] - # - attr_reader :list_glossary_entries - ## - # RPC-specific configuration for `create_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :create_glossary_entry - ## - # RPC-specific configuration for `update_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :update_glossary_entry - ## - # RPC-specific configuration for `delete_glossary_entry` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_glossary_entry - ## - # RPC-specific configuration for `create_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :create_dataset - ## - # RPC-specific configuration for `get_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :get_dataset - ## - # RPC-specific configuration for `list_datasets` - # @return [::Gapic::Config::Method] - # - attr_reader :list_datasets - ## - # RPC-specific configuration for `delete_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_dataset - ## - # RPC-specific configuration for `create_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :create_adaptive_mt_dataset - ## - # RPC-specific configuration for `delete_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_adaptive_mt_dataset - ## - # RPC-specific configuration for `get_adaptive_mt_dataset` - # @return [::Gapic::Config::Method] - # - attr_reader :get_adaptive_mt_dataset - ## - # RPC-specific configuration for `list_adaptive_mt_datasets` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_datasets - ## - # RPC-specific configuration for `adaptive_mt_translate` - # @return [::Gapic::Config::Method] - # - attr_reader :adaptive_mt_translate - ## - # RPC-specific configuration for `get_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :get_adaptive_mt_file - ## - # RPC-specific configuration for `delete_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_adaptive_mt_file - ## - # RPC-specific configuration for `import_adaptive_mt_file` - # @return [::Gapic::Config::Method] - # - attr_reader :import_adaptive_mt_file - ## - # RPC-specific configuration for `list_adaptive_mt_files` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_files - ## - # RPC-specific configuration for `list_adaptive_mt_sentences` - # @return [::Gapic::Config::Method] - # - attr_reader :list_adaptive_mt_sentences - ## - # RPC-specific configuration for `import_data` - # @return [::Gapic::Config::Method] - # - attr_reader :import_data - ## - # RPC-specific configuration for `export_data` - # @return [::Gapic::Config::Method] - # - attr_reader :export_data - ## - # RPC-specific configuration for `list_examples` - # @return [::Gapic::Config::Method] - # - attr_reader :list_examples - ## - # RPC-specific configuration for `create_model` - # @return [::Gapic::Config::Method] - # - attr_reader :create_model - ## - # RPC-specific configuration for `list_models` - # @return [::Gapic::Config::Method] - # - attr_reader :list_models - ## - # RPC-specific configuration for `get_model` - # @return [::Gapic::Config::Method] - # - attr_reader :get_model - ## - # RPC-specific configuration for `delete_model` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_model - - # @private - def initialize parent_rpcs = nil - translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text - @translate_text = ::Gapic::Config::Method.new translate_text_config - romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text - @romanize_text = ::Gapic::Config::Method.new romanize_text_config - detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language - @detect_language = ::Gapic::Config::Method.new detect_language_config - get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages - @get_supported_languages = ::Gapic::Config::Method.new get_supported_languages_config - translate_document_config = parent_rpcs.translate_document if parent_rpcs.respond_to? :translate_document - @translate_document = ::Gapic::Config::Method.new translate_document_config - batch_translate_text_config = parent_rpcs.batch_translate_text if parent_rpcs.respond_to? :batch_translate_text - @batch_translate_text = ::Gapic::Config::Method.new batch_translate_text_config - batch_translate_document_config = parent_rpcs.batch_translate_document if parent_rpcs.respond_to? :batch_translate_document - @batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config - create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary - @create_glossary = ::Gapic::Config::Method.new create_glossary_config - update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary - @update_glossary = ::Gapic::Config::Method.new update_glossary_config - list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries - @list_glossaries = ::Gapic::Config::Method.new list_glossaries_config - get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary - @get_glossary = ::Gapic::Config::Method.new get_glossary_config - delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary - @delete_glossary = ::Gapic::Config::Method.new delete_glossary_config - get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry - @get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config - list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries - @list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config - create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry - @create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config - update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry - @update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config - delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry - @delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config - create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset - @create_dataset = ::Gapic::Config::Method.new create_dataset_config - get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset - @get_dataset = ::Gapic::Config::Method.new get_dataset_config - list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets - @list_datasets = ::Gapic::Config::Method.new list_datasets_config - delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset - @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config - create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset - @create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config - delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset - @delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config - get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset - @get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config - list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets - @list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config - adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate - @adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config - get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file - @get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config - delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file - @delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config - import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file - @import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config - list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files - @list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config - list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences - @list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config - import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data - @import_data = ::Gapic::Config::Method.new import_data_config - export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data - @export_data = ::Gapic::Config::Method.new export_data_config - list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples - @list_examples = ::Gapic::Config::Method.new list_examples_config - create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model - @create_model = ::Gapic::Config::Method.new create_model_config - list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models - @list_models = ::Gapic::Config::Method.new list_models_config - get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model - @get_model = ::Gapic::Config::Method.new get_model_config - delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model - @delete_model = ::Gapic::Config::Method.new delete_model_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb deleted file mode 100644 index fe150ccbe903..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/operations.rb +++ /dev/null @@ -1,1093 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the TranslationService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the TranslationService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Translate::V3::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.wait_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "translate.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the wait_operation REST call - # - # @param request_pb [::Google::Longrunning::WaitOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def wait_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_wait_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "wait_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the wait_operation REST call - # - # @param request_pb [::Google::Longrunning::WaitOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_wait_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{name}:wait", - body: "*", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb deleted file mode 100644 index 2bee326ee72a..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +++ /dev/null @@ -1,2454 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/translate/v3/translation_service_pb" - -module Google - module Cloud - module Translate - module V3 - module TranslationService - module Rest - ## - # REST service stub for the TranslationService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the translate_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::TranslateTextRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::TranslateTextResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::TranslateTextResponse] - # A result object deserialized from the server's reply - def translate_text request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_translate_text_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "translate_text", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::TranslateTextResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the romanize_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::RomanizeTextRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse] - # A result object deserialized from the server's reply - def romanize_text request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_romanize_text_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "romanize_text", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::RomanizeTextResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the detect_language REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DetectLanguageRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::DetectLanguageResponse] - # A result object deserialized from the server's reply - def detect_language request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_detect_language_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "detect_language", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::DetectLanguageResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_supported_languages REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::SupportedLanguages] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::SupportedLanguages] - # A result object deserialized from the server's reply - def get_supported_languages request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_supported_languages_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_supported_languages", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::SupportedLanguages.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the translate_document REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::TranslateDocumentRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse] - # A result object deserialized from the server's reply - def translate_document request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_translate_document_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "translate_document", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the batch_translate_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateTextRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def batch_translate_text request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_batch_translate_text_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "batch_translate_text", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the batch_translate_document REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def batch_translate_document request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_batch_translate_document_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "batch_translate_document", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the create_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def create_glossary request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_glossary_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_glossary", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def update_glossary request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_glossary_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_glossary", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_glossaries REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListGlossariesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListGlossariesResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListGlossariesResponse] - # A result object deserialized from the server's reply - def list_glossaries request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_glossaries_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_glossaries", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListGlossariesResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Glossary] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Glossary] - # A result object deserialized from the server's reply - def get_glossary request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_glossary_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_glossary", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::Glossary.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def delete_glossary request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_glossary_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_glossary", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # A result object deserialized from the server's reply - def get_glossary_entry request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_glossary_entry_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_glossary_entry", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_glossary_entries REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse] - # A result object deserialized from the server's reply - def list_glossary_entries request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_glossary_entries_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_glossary_entries", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the create_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # A result object deserialized from the server's reply - def create_glossary_entry request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_glossary_entry_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_glossary_entry", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # A result object deserialized from the server's reply - def update_glossary_entry request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_glossary_entry_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_glossary_entry", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::GlossaryEntry.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_glossary_entry request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_glossary_entry_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_glossary_entry", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the create_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def create_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Dataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Dataset] - # A result object deserialized from the server's reply - def get_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::Dataset.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_datasets REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListDatasetsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListDatasetsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListDatasetsResponse] - # A result object deserialized from the server's reply - def list_datasets request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_datasets_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_datasets", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def delete_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the create_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # A result object deserialized from the server's reply - def create_adaptive_mt_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_adaptive_mt_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_adaptive_mt_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_adaptive_mt_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_adaptive_mt_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_adaptive_mt_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # A result object deserialized from the server's reply - def get_adaptive_mt_dataset request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_adaptive_mt_dataset_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_adaptive_mt_dataset", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_adaptive_mt_datasets REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse] - # A result object deserialized from the server's reply - def list_adaptive_mt_datasets request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_datasets_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_adaptive_mt_datasets", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the adaptive_mt_translate REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse] - # A result object deserialized from the server's reply - def adaptive_mt_translate request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_adaptive_mt_translate_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "adaptive_mt_translate", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # A result object deserialized from the server's reply - def get_adaptive_mt_file request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_adaptive_mt_file_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_adaptive_mt_file", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::AdaptiveMtFile.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_adaptive_mt_file request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_adaptive_mt_file_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_adaptive_mt_file", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the import_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse] - # A result object deserialized from the server's reply - def import_adaptive_mt_file request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_import_adaptive_mt_file_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "import_adaptive_mt_file", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_adaptive_mt_files REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse] - # A result object deserialized from the server's reply - def list_adaptive_mt_files request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_files_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_adaptive_mt_files", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_adaptive_mt_sentences REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse] - # A result object deserialized from the server's reply - def list_adaptive_mt_sentences request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_adaptive_mt_sentences_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_adaptive_mt_sentences", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the import_data REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ImportDataRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def import_data request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_import_data_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "import_data", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the export_data REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ExportDataRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def export_data request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_export_data_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "export_data", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_examples REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListExamplesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListExamplesResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListExamplesResponse] - # A result object deserialized from the server's reply - def list_examples request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_examples_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_examples", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListExamplesResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the create_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def create_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_models REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListModelsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::ListModelsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::ListModelsResponse] - # A result object deserialized from the server's reply - def list_models request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_models", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Translate::V3::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Translate::V3::Model] - # A result object deserialized from the server's reply - def get_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Translate::V3::Model.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def delete_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the translate_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::TranslateTextRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_translate_text_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:translateText", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:translateText", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the romanize_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::RomanizeTextRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_romanize_text_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:romanizeText", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:romanizeText", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the detect_language REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DetectLanguageRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_detect_language_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:detectLanguage", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:detectLanguage", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_supported_languages REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_supported_languages_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/supportedLanguages", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/supportedLanguages", - matches: [ - ["parent", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the translate_document REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::TranslateDocumentRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_translate_document_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:translateDocument", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the batch_translate_text REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateTextRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_batch_translate_text_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:batchTranslateText", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the batch_translate_document REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_batch_translate_document_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:batchTranslateDocument", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the create_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_glossary_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}/glossaries", - body: "glossary", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_glossary_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v3/{glossary.name}", - body: "glossary", - matches: [ - ["glossary.name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_glossaries REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListGlossariesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_glossaries_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/glossaries", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_glossary_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_glossary REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_glossary_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_glossary_entry_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_glossary_entries REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_glossary_entries_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/glossaryEntries", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the create_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_glossary_entry_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}/glossaryEntries", - body: "glossary_entry", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_glossary_entry_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v3/{glossary_entry.name}", - body: "glossary_entry", - matches: [ - ["glossary_entry.name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_glossary_entry REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_glossary_entry_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the create_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}/datasets", - body: "dataset", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_datasets REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListDatasetsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_datasets_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/datasets", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the create_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_adaptive_mt_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}/adaptiveMtDatasets", - body: "adaptive_mt_dataset", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_adaptive_mt_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_adaptive_mt_dataset REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_adaptive_mt_dataset_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_adaptive_mt_datasets REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_adaptive_mt_datasets_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/adaptiveMtDatasets", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the adaptive_mt_translate REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_adaptive_mt_translate_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:adaptiveMtTranslate", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_adaptive_mt_file_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_adaptive_mt_file_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the import_adaptive_mt_file REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_import_adaptive_mt_file_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}:importAdaptiveMtFile", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_adaptive_mt_files REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_adaptive_mt_files_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/adaptiveMtFiles", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_adaptive_mt_sentences REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_adaptive_mt_sentences_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/adaptiveMtSentences", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/adaptiveMtFiles/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/adaptiveMtSentences", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/adaptiveMtDatasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the import_data REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ImportDataRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_import_data_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{dataset}:importData", - body: "*", - matches: [ - ["dataset", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the export_data REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ExportDataRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_export_data_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{dataset}:exportData", - body: "*", - matches: [ - ["dataset", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_examples REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListExamplesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_examples_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/examples", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the create_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::CreateModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v3/{parent}/models", - body: "model", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_models REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::ListModelsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_models_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{parent}/models", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::GetModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_model REST call - # - # @param request_pb [::Google::Cloud::Translate::V3::DeleteModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v3/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb deleted file mode 100644 index 23109d6811b2..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_pb.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/translate/v3/translation_service.proto - -require 'google/protobuf' - -require 'google/cloud/translate/v3/adaptive_mt_pb' -require 'google/cloud/translate/v3/automl_translation_pb' -require 'google/cloud/translate/v3/common_pb' -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/longrunning/operations_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n3google/cloud/translate/v3/translation_service.proto\x12\x1bgoogle.cloud.translation.v3\x1a+google/cloud/translate/v3/adaptive_mt.proto\x1a\x32google/cloud/translate/v3/automl_translation.proto\x1a&google/cloud/translate/v3/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"7\n\x15TransliterationConfig\x12\x1e\n\x16\x65nable_transliteration\x18\x01 \x01(\x08\"\x8e\x04\n\x14TranslateTextRequest\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14source_language_code\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x06parent\x18\x08 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12W\n\x16transliteration_config\x18\r \x01(\x0b\x32\x32.google.cloud.translation.v3.TransliterationConfigB\x03\xe0\x41\x01\x12R\n\x06labels\x18\n \x03(\x0b\x32=.google.cloud.translation.v3.TranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xa0\x01\n\x15TranslateTextResponse\x12>\n\x0ctranslations\x18\x01 \x03(\x0b\x32(.google.cloud.translation.v3.Translation\x12G\n\x15glossary_translations\x18\x03 \x03(\x0b\x32(.google.cloud.translation.v3.Translation\"\xa8\x01\n\x0bTranslation\x12\x17\n\x0ftranslated_text\x18\x01 \x01(\t\x12\r\n\x05model\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x04 \x01(\t\x12Q\n\x0fglossary_config\x18\x03 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig\"\x8a\x01\n\x13RomanizeTextRequest\x12\x39\n\x06parent\x18\x04 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x15\n\x08\x63ontents\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\"F\n\x0cRomanization\x12\x16\n\x0eromanized_text\x18\x01 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x02 \x01(\t\"X\n\x14RomanizeTextResponse\x12@\n\rromanizations\x18\x01 \x03(\x0b\x32).google.cloud.translation.v3.Romanization\"\x9f\x02\n\x15\x44\x65tectLanguageRequest\x12\x39\n\x06parent\x18\x05 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x12\n\x05model\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x11\n\x07\x63ontent\x18\x01 \x01(\tH\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12S\n\x06labels\x18\x06 \x03(\x0b\x32>.google.cloud.translation.v3.DetectLanguageRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06source\"=\n\x10\x44\x65tectedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\"Z\n\x16\x44\x65tectLanguageResponse\x12@\n\tlanguages\x18\x01 \x03(\x0b\x32-.google.cloud.translation.v3.DetectedLanguage\"\x91\x01\n\x1cGetSupportedLanguagesRequest\x12\x39\n\x06parent\x18\x03 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\"\n\x15\x64isplay_language_code\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x02 \x01(\tB\x03\xe0\x41\x01\"W\n\x12SupportedLanguages\x12\x41\n\tlanguages\x18\x01 \x03(\x0b\x32..google.cloud.translation.v3.SupportedLanguage\"p\n\x11SupportedLanguage\x12\x15\n\rlanguage_code\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x16\n\x0esupport_source\x18\x03 \x01(\x08\x12\x16\n\x0esupport_target\x18\x04 \x01(\x08\"#\n\tGcsSource\x12\x16\n\tinput_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\"m\n\x0bInputConfig\x12\x16\n\tmime_type\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"0\n\x0eGcsDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\"e\n\x0cOutputConfig\x12\x46\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\x83\x01\n\x13\x44ocumentInputConfig\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x12\x11\n\tmime_type\x18\x04 \x01(\tB\x08\n\x06source\"\x8a\x01\n\x14\x44ocumentOutputConfig\x12K\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationB\x03\xe0\x41\x01H\x00\x12\x16\n\tmime_type\x18\x03 \x01(\tB\x03\xe0\x41\x01\x42\r\n\x0b\x64\x65stination\"\xbe\x05\n\x18TranslateDocumentRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12!\n\x14target_language_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12T\n\x15\x64ocument_input_config\x18\x04 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentInputConfigB\x03\xe0\x41\x02\x12V\n\x16\x64ocument_output_config\x18\x05 \x01(\x0b\x32\x31.google.cloud.translation.v3.DocumentOutputConfigB\x03\xe0\x41\x01\x12\x12\n\x05model\x18\x06 \x01(\tB\x03\xe0\x41\x01\x12V\n\x0fglossary_config\x18\x07 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfigB\x03\xe0\x41\x01\x12V\n\x06labels\x18\x08 \x03(\x0b\x32\x41.google.cloud.translation.v3.TranslateDocumentRequest.LabelsEntryB\x03\xe0\x41\x01\x12#\n\x16\x63ustomized_attribution\x18\n \x01(\tB\x03\xe0\x41\x01\x12)\n\x1cis_translate_native_pdf_only\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01\x12-\n enable_shadow_removal_native_pdf\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65nable_rotation_correction\x18\r \x01(\x08\x42\x03\xe0\x41\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"e\n\x13\x44ocumentTranslation\x12\x1b\n\x13\x62yte_stream_outputs\x18\x01 \x03(\x0c\x12\x11\n\tmime_type\x18\x02 \x01(\t\x12\x1e\n\x16\x64\x65tected_language_code\x18\x03 \x01(\t\"\xa6\x02\n\x19TranslateDocumentResponse\x12N\n\x14\x64ocument_translation\x18\x01 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentTranslation\x12W\n\x1dglossary_document_translation\x18\x02 \x01(\x0b\x32\x30.google.cloud.translation.v3.DocumentTranslation\x12\r\n\x05model\x18\x03 \x01(\t\x12Q\n\x0fglossary_config\x18\x04 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig\"\x88\x06\n\x19\x42\x61tchTranslateTextRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12W\n\x06models\x18\x04 \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.ModelsEntryB\x03\xe0\x41\x01\x12\x44\n\rinput_configs\x18\x05 \x03(\x0b\x32(.google.cloud.translation.v3.InputConfigB\x03\xe0\x41\x02\x12\x45\n\routput_config\x18\x06 \x01(\x0b\x32).google.cloud.translation.v3.OutputConfigB\x03\xe0\x41\x02\x12_\n\nglossaries\x18\x07 \x03(\x0b\x32\x46.google.cloud.translation.v3.BatchTranslateTextRequest.GlossariesEntryB\x03\xe0\x41\x01\x12W\n\x06labels\x18\t \x03(\x0b\x32\x42.google.cloud.translation.v3.BatchTranslateTextRequest.LabelsEntryB\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ak\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xce\x02\n\x16\x42\x61tchTranslateMetadata\x12H\n\x05state\x18\x01 \x01(\x0e\x32\x39.google.cloud.translation.v3.BatchTranslateMetadata.State\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12\x18\n\x10total_characters\x18\x04 \x01(\x03\x12/\n\x0bsubmit_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xcb\x01\n\x16\x42\x61tchTranslateResponse\x12\x18\n\x10total_characters\x18\x01 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x02 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x03 \x01(\x03\x12/\n\x0bsubmit_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"]\n\x13GlossaryInputConfig\x12<\n\ngcs_source\x18\x01 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"\x9a\x05\n\x08Glossary\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12O\n\rlanguage_pair\x18\x03 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodePairH\x00\x12T\n\x12language_codes_set\x18\x04 \x01(\x0b\x32\x36.google.cloud.translation.v3.Glossary.LanguageCodesSetH\x00\x12\x46\n\x0cinput_config\x18\x05 \x01(\x0b\x32\x30.google.cloud.translation.v3.GlossaryInputConfig\x12\x18\n\x0b\x65ntry_count\x18\x06 \x01(\x05\x42\x03\xe0\x41\x03\x12\x34\n\x0bsubmit_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x19\n\x0c\x64isplay_name\x18\t \x01(\tB\x03\xe0\x41\x01\x1aN\n\x10LanguageCodePair\x12\x1c\n\x14source_language_code\x18\x01 \x01(\t\x12\x1c\n\x14target_language_code\x18\x02 \x01(\t\x1a*\n\x10LanguageCodesSet\x12\x16\n\x0elanguage_codes\x18\x01 \x03(\t:e\xea\x41\x62\n!translate.googleapis.com/Glossary\x12=projects/{project}/locations/{location}/glossaries/{glossary}B\x0b\n\tlanguages\"\x90\x01\n\x15\x43reateGlossaryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12<\n\x08glossary\x18\x02 \x01(\x0b\x32%.google.cloud.translation.v3.GlossaryB\x03\xe0\x41\x02\"\x86\x01\n\x15UpdateGlossaryRequest\x12<\n\x08glossary\x18\x01 \x01(\x0b\x32%.google.cloud.translation.v3.GlossaryB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"M\n\x12GetGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\"P\n\x15\x44\x65leteGlossaryRequest\x12\x37\n\x04name\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\"\x98\x01\n\x15ListGlossariesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"l\n\x16ListGlossariesResponse\x12\x39\n\nglossaries\x18\x01 \x03(\x0b\x32%.google.cloud.translation.v3.Glossary\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"W\n\x17GetGlossaryEntryRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&translate.googleapis.com/GlossaryEntry\"Z\n\x1a\x44\x65leteGlossaryEntryRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&translate.googleapis.com/GlossaryEntry\"\x88\x01\n\x1aListGlossaryEntriesRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"\x86\x01\n\x1bListGlossaryEntriesResponse\x12I\n\x10glossary_entries\x18\x01 \x03(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x01\x12\x1c\n\x0fnext_page_token\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\xa0\x01\n\x1a\x43reateGlossaryEntryRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12G\n\x0eglossary_entry\x18\x02 \x01(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x02\"e\n\x1aUpdateGlossaryEntryRequest\x12G\n\x0eglossary_entry\x18\x01 \x01(\x0b\x32*.google.cloud.translation.v3.GlossaryEntryB\x03\xe0\x41\x02\"\x88\x02\n\x16\x43reateGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.CreateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xb3\x02\n\x16UpdateGlossaryMetadata\x12\x37\n\x08glossary\x18\x01 \x01(\x0b\x32%.google.cloud.translation.v3.Glossary\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.UpdateGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\x88\x02\n\x16\x44\x65leteGlossaryMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12H\n\x05state\x18\x02 \x01(\x0e\x32\x39.google.cloud.translation.v3.DeleteGlossaryMetadata.State\x12/\n\x0bsubmit_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\x85\x01\n\x16\x44\x65leteGlossaryResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12/\n\x0bsubmit_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xd1\x07\n\x1d\x42\x61tchTranslateDocumentRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12!\n\x14source_language_code\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\"\n\x15target_language_codes\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12Q\n\rinput_configs\x18\x04 \x03(\x0b\x32\x35.google.cloud.translation.v3.BatchDocumentInputConfigB\x03\xe0\x41\x02\x12R\n\routput_config\x18\x05 \x01(\x0b\x32\x36.google.cloud.translation.v3.BatchDocumentOutputConfigB\x03\xe0\x41\x02\x12[\n\x06models\x18\x06 \x03(\x0b\x32\x46.google.cloud.translation.v3.BatchTranslateDocumentRequest.ModelsEntryB\x03\xe0\x41\x01\x12\x63\n\nglossaries\x18\x07 \x03(\x0b\x32J.google.cloud.translation.v3.BatchTranslateDocumentRequest.GlossariesEntryB\x03\xe0\x41\x01\x12r\n\x12\x66ormat_conversions\x18\x08 \x03(\x0b\x32Q.google.cloud.translation.v3.BatchTranslateDocumentRequest.FormatConversionsEntryB\x03\xe0\x41\x01\x12#\n\x16\x63ustomized_attribution\x18\n \x01(\tB\x03\xe0\x41\x01\x12-\n enable_shadow_removal_native_pdf\x18\x0b \x01(\x08\x42\x03\xe0\x41\x01\x12\'\n\x1a\x65nable_rotation_correction\x18\x0c \x01(\x08\x42\x03\xe0\x41\x01\x1a-\n\x0bModelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1ak\n\x0fGlossariesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.cloud.translation.v3.TranslateTextGlossaryConfig:\x02\x38\x01\x1a\x38\n\x16\x46ormatConversionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"b\n\x18\x42\x61tchDocumentInputConfig\x12<\n\ngcs_source\x18\x01 \x01(\x0b\x32&.google.cloud.translation.v3.GcsSourceH\x00\x42\x08\n\x06source\"r\n\x19\x42\x61tchDocumentOutputConfig\x12\x46\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32+.google.cloud.translation.v3.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination\"\xd9\x02\n\x1e\x42\x61tchTranslateDocumentResponse\x12\x13\n\x0btotal_pages\x18\x01 \x01(\x03\x12\x18\n\x10translated_pages\x18\x02 \x01(\x03\x12\x14\n\x0c\x66\x61iled_pages\x18\x03 \x01(\x03\x12\x1c\n\x14total_billable_pages\x18\x04 \x01(\x03\x12\x18\n\x10total_characters\x18\x05 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x06 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x07 \x01(\x03\x12!\n\x19total_billable_characters\x18\x08 \x01(\x03\x12/\n\x0bsubmit_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xe4\x03\n\x1e\x42\x61tchTranslateDocumentMetadata\x12P\n\x05state\x18\x01 \x01(\x0e\x32\x41.google.cloud.translation.v3.BatchTranslateDocumentMetadata.State\x12\x13\n\x0btotal_pages\x18\x02 \x01(\x03\x12\x18\n\x10translated_pages\x18\x03 \x01(\x03\x12\x14\n\x0c\x66\x61iled_pages\x18\x04 \x01(\x03\x12\x1c\n\x14total_billable_pages\x18\x05 \x01(\x03\x12\x18\n\x10total_characters\x18\x06 \x01(\x03\x12\x1d\n\x15translated_characters\x18\x07 \x01(\x03\x12\x19\n\x11\x66\x61iled_characters\x18\x08 \x01(\x03\x12!\n\x19total_billable_characters\x18\t \x01(\x03\x12/\n\x0bsubmit_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"e\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\n\n\x06\x46\x41ILED\x10\x03\x12\x0e\n\nCANCELLING\x10\x04\x12\r\n\tCANCELLED\x10\x05\"\xa1\x01\n\x1bTranslateTextGlossaryConfig\x12;\n\x08glossary\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!translate.googleapis.com/Glossary\x12\x18\n\x0bignore_case\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12+\n\x1e\x63ontextual_translation_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\x32\xbd\x43\n\x12TranslationService\x12\xd4\x02\n\rTranslateText\x12\x31.google.cloud.translation.v3.TranslateTextRequest\x1a\x32.google.cloud.translation.v3.TranslateTextResponse\"\xdb\x01\xda\x41$parent,target_language_code,contents\xda\x41Iparent,model,mime_type,source_language_code,target_language_code,contents\x82\xd3\xe4\x93\x02\x62\"1/v3/{parent=projects/*/locations/*}:translateText:\x01*Z*\"%/v3/{parent=projects/*}:translateText:\x01*\x12\xed\x01\n\x0cRomanizeText\x12\x30.google.cloud.translation.v3.RomanizeTextRequest\x1a\x31.google.cloud.translation.v3.RomanizeTextResponse\"x\xda\x41\x0fparent,contents\x82\xd3\xe4\x93\x02`\"0/v3/{parent=projects/*/locations/*}:romanizeText:\x01*Z)\"$/v3/{parent=projects/*}:romanizeText:\x01*\x12\x87\x02\n\x0e\x44\x65tectLanguage\x12\x32.google.cloud.translation.v3.DetectLanguageRequest\x1a\x33.google.cloud.translation.v3.DetectLanguageResponse\"\x8b\x01\xda\x41\x1eparent,model,mime_type,content\x82\xd3\xe4\x93\x02\x64\"2/v3/{parent=projects/*/locations/*}:detectLanguage:\x01*Z+\"&/v3/{parent=projects/*}:detectLanguage:\x01*\x12\x97\x02\n\x15GetSupportedLanguages\x12\x39.google.cloud.translation.v3.GetSupportedLanguagesRequest\x1a/.google.cloud.translation.v3.SupportedLanguages\"\x91\x01\xda\x41\"parent,model,display_language_code\x82\xd3\xe4\x93\x02\x66\x12\x36/v3/{parent=projects/*/locations/*}/supportedLanguagesZ,\x12*/v3/{parent=projects/*}/supportedLanguages\x12\xc4\x01\n\x11TranslateDocument\x12\x35.google.cloud.translation.v3.TranslateDocumentRequest\x1a\x36.google.cloud.translation.v3.TranslateDocumentResponse\"@\x82\xd3\xe4\x93\x02:\"5/v3/{parent=projects/*/locations/*}:translateDocument:\x01*\x12\xe1\x01\n\x12\x42\x61tchTranslateText\x12\x36.google.cloud.translation.v3.BatchTranslateTextRequest\x1a\x1d.google.longrunning.Operation\"t\xca\x41\x30\n\x16\x42\x61tchTranslateResponse\x12\x16\x42\x61tchTranslateMetadata\x82\xd3\xe4\x93\x02;\"6/v3/{parent=projects/*/locations/*}:batchTranslateText:\x01*\x12\xce\x02\n\x16\x42\x61tchTranslateDocument\x12:.google.cloud.translation.v3.BatchTranslateDocumentRequest\x1a\x1d.google.longrunning.Operation\"\xd8\x01\xca\x41@\n\x1e\x42\x61tchTranslateDocumentResponse\x12\x1e\x42\x61tchTranslateDocumentMetadata\xda\x41Mparent,source_language_code,target_language_codes,input_configs,output_config\x82\xd3\xe4\x93\x02?\":/v3/{parent=projects/*/locations/*}:batchTranslateDocument:\x01*\x12\xdc\x01\n\x0e\x43reateGlossary\x12\x32.google.cloud.translation.v3.CreateGlossaryRequest\x1a\x1d.google.longrunning.Operation\"w\xca\x41\"\n\x08Glossary\x12\x16\x43reateGlossaryMetadata\xda\x41\x0fparent,glossary\x82\xd3\xe4\x93\x02:\"./v3/{parent=projects/*/locations/*}/glossaries:\x08glossary\x12\xeb\x01\n\x0eUpdateGlossary\x12\x32.google.cloud.translation.v3.UpdateGlossaryRequest\x1a\x1d.google.longrunning.Operation\"\x85\x01\xca\x41\"\n\x08Glossary\x12\x16UpdateGlossaryMetadata\xda\x41\x14glossary,update_mask\x82\xd3\xe4\x93\x02\x43\x32\x37/v3/{glossary.name=projects/*/locations/*/glossaries/*}:\x08glossary\x12\xba\x01\n\x0eListGlossaries\x12\x32.google.cloud.translation.v3.ListGlossariesRequest\x1a\x33.google.cloud.translation.v3.ListGlossariesResponse\"?\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x30\x12./v3/{parent=projects/*/locations/*}/glossaries\x12\xa4\x01\n\x0bGetGlossary\x12/.google.cloud.translation.v3.GetGlossaryRequest\x1a%.google.cloud.translation.v3.Glossary\"=\xda\x41\x04name\x82\xd3\xe4\x93\x02\x30\x12./v3/{name=projects/*/locations/*/glossaries/*}\x12\xd5\x01\n\x0e\x44\x65leteGlossary\x12\x32.google.cloud.translation.v3.DeleteGlossaryRequest\x1a\x1d.google.longrunning.Operation\"p\xca\x41\x30\n\x16\x44\x65leteGlossaryResponse\x12\x16\x44\x65leteGlossaryMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02\x30*./v3/{name=projects/*/locations/*/glossaries/*}\x12\xc5\x01\n\x10GetGlossaryEntry\x12\x34.google.cloud.translation.v3.GetGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"O\xda\x41\x04name\x82\xd3\xe4\x93\x02\x42\x12@/v3/{name=projects/*/locations/*/glossaries/*/glossaryEntries/*}\x12\xdb\x01\n\x13ListGlossaryEntries\x12\x37.google.cloud.translation.v3.ListGlossaryEntriesRequest\x1a\x38.google.cloud.translation.v3.ListGlossaryEntriesResponse\"Q\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x42\x12@/v3/{parent=projects/*/locations/*/glossaries/*}/glossaryEntries\x12\xec\x01\n\x13\x43reateGlossaryEntry\x12\x37.google.cloud.translation.v3.CreateGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"p\xda\x41\x15parent,glossary_entry\x82\xd3\xe4\x93\x02R\"@/v3/{parent=projects/*/locations/*/glossaries/*}/glossaryEntries:\x0eglossary_entry\x12\xf4\x01\n\x13UpdateGlossaryEntry\x12\x37.google.cloud.translation.v3.UpdateGlossaryEntryRequest\x1a*.google.cloud.translation.v3.GlossaryEntry\"x\xda\x41\x0eglossary_entry\x82\xd3\xe4\x93\x02\x61\x32O/v3/{glossary_entry.name=projects/*/locations/*/glossaries/*/glossaryEntries/*}:\x0eglossary_entry\x12\xb7\x01\n\x13\x44\x65leteGlossaryEntry\x12\x37.google.cloud.translation.v3.DeleteGlossaryEntryRequest\x1a\x16.google.protobuf.Empty\"O\xda\x41\x04name\x82\xd3\xe4\x93\x02\x42*@/v3/{name=projects/*/locations/*/glossaries/*/glossaryEntries/*}\x12\xd4\x01\n\rCreateDataset\x12\x31.google.cloud.translation.v3.CreateDatasetRequest\x1a\x1d.google.longrunning.Operation\"q\xca\x41 \n\x07\x44\x61taset\x12\x15\x43reateDatasetMetadata\xda\x41\x0eparent,dataset\x82\xd3\xe4\x93\x02\x37\",/v3/{parent=projects/*/locations/*}/datasets:\x07\x64\x61taset\x12\x9f\x01\n\nGetDataset\x12..google.cloud.translation.v3.GetDatasetRequest\x1a$.google.cloud.translation.v3.Dataset\";\xda\x41\x04name\x82\xd3\xe4\x93\x02.\x12,/v3/{name=projects/*/locations/*/datasets/*}\x12\xb2\x01\n\x0cListDatasets\x12\x30.google.cloud.translation.v3.ListDatasetsRequest\x1a\x31.google.cloud.translation.v3.ListDatasetsResponse\"=\xda\x41\x06parent\x82\xd3\xe4\x93\x02.\x12,/v3/{parent=projects/*/locations/*}/datasets\x12\xcf\x01\n\rDeleteDataset\x12\x31.google.cloud.translation.v3.DeleteDatasetRequest\x1a\x1d.google.longrunning.Operation\"l\xca\x41.\n\x15google.protobuf.Empty\x12\x15\x44\x65leteDatasetMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02.*,/v3/{name=projects/*/locations/*/datasets/*}\x12\xf8\x01\n\x17\x43reateAdaptiveMtDataset\x12;.google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest\x1a..google.cloud.translation.v3.AdaptiveMtDataset\"p\xda\x41\x1aparent,adaptive_mt_dataset\x82\xd3\xe4\x93\x02M\"6/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets:\x13\x61\x64\x61ptive_mt_dataset\x12\xb5\x01\n\x17\x44\x65leteAdaptiveMtDataset\x12;.google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest\x1a\x16.google.protobuf.Empty\"E\xda\x41\x04name\x82\xd3\xe4\x93\x02\x38*6/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}\x12\xc7\x01\n\x14GetAdaptiveMtDataset\x12\x38.google.cloud.translation.v3.GetAdaptiveMtDatasetRequest\x1a..google.cloud.translation.v3.AdaptiveMtDataset\"E\xda\x41\x04name\x82\xd3\xe4\x93\x02\x38\x12\x36/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}\x12\xda\x01\n\x16ListAdaptiveMtDatasets\x12:.google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest\x1a;.google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse\"G\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x38\x12\x36/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets\x12\xdd\x01\n\x13\x41\x64\x61ptiveMtTranslate\x12\x37.google.cloud.translation.v3.AdaptiveMtTranslateRequest\x1a\x38.google.cloud.translation.v3.AdaptiveMtTranslateResponse\"S\xda\x41\x0eparent,content\x82\xd3\xe4\x93\x02<\"7/v3/{parent=projects/*/locations/*}:adaptiveMtTranslate:\x01*\x12\xd0\x01\n\x11GetAdaptiveMtFile\x12\x35.google.cloud.translation.v3.GetAdaptiveMtFileRequest\x1a+.google.cloud.translation.v3.AdaptiveMtFile\"W\xda\x41\x04name\x82\xd3\xe4\x93\x02J\x12H/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}\x12\xc1\x01\n\x14\x44\x65leteAdaptiveMtFile\x12\x38.google.cloud.translation.v3.DeleteAdaptiveMtFileRequest\x1a\x16.google.protobuf.Empty\"W\xda\x41\x04name\x82\xd3\xe4\x93\x02J*H/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}\x12\xee\x01\n\x14ImportAdaptiveMtFile\x12\x38.google.cloud.translation.v3.ImportAdaptiveMtFileRequest\x1a\x39.google.cloud.translation.v3.ImportAdaptiveMtFileResponse\"a\xda\x41\x06parent\x82\xd3\xe4\x93\x02R\"M/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}:importAdaptiveMtFile:\x01*\x12\xe3\x01\n\x13ListAdaptiveMtFiles\x12\x37.google.cloud.translation.v3.ListAdaptiveMtFilesRequest\x1a\x38.google.cloud.translation.v3.ListAdaptiveMtFilesResponse\"Y\xda\x41\x06parent\x82\xd3\xe4\x93\x02J\x12H/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtFiles\x12\xd7\x02\n\x17ListAdaptiveMtSentences\x12;.google.cloud.translation.v3.ListAdaptiveMtSentencesRequest\x1a<.google.cloud.translation.v3.ListAdaptiveMtSentencesResponse\"\xc0\x01\xda\x41\x06parent\x82\xd3\xe4\x93\x02\xb0\x01\x12^/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}/adaptiveMtSentencesZN\x12L/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtSentences\x12\xe8\x01\n\nImportData\x12..google.cloud.translation.v3.ImportDataRequest\x1a\x1d.google.longrunning.Operation\"\x8a\x01\xca\x41+\n\x15google.protobuf.Empty\x12\x12ImportDataMetadata\xda\x41\x14\x64\x61taset,input_config\x82\xd3\xe4\x93\x02?\":/v3/{dataset=projects/*/locations/*/datasets/*}:importData:\x01*\x12\xe9\x01\n\nExportData\x12..google.cloud.translation.v3.ExportDataRequest\x1a\x1d.google.longrunning.Operation\"\x8b\x01\xca\x41+\n\x15google.protobuf.Empty\x12\x12\x45xportDataMetadata\xda\x41\x15\x64\x61taset,output_config\x82\xd3\xe4\x93\x02?\":/v3/{dataset=projects/*/locations/*/datasets/*}:exportData:\x01*\x12\xbd\x01\n\x0cListExamples\x12\x30.google.cloud.translation.v3.ListExamplesRequest\x1a\x31.google.cloud.translation.v3.ListExamplesResponse\"H\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x39\x12\x37/v3/{parent=projects/*/locations/*/datasets/*}/examples\x12\xc6\x01\n\x0b\x43reateModel\x12/.google.cloud.translation.v3.CreateModelRequest\x1a\x1d.google.longrunning.Operation\"g\xca\x41\x1c\n\x05Model\x12\x13\x43reateModelMetadata\xda\x41\x0cparent,model\x82\xd3\xe4\x93\x02\x33\"*/v3/{parent=projects/*/locations/*}/models:\x05model\x12\xaa\x01\n\nListModels\x12..google.cloud.translation.v3.ListModelsRequest\x1a/.google.cloud.translation.v3.ListModelsResponse\";\xda\x41\x06parent\x82\xd3\xe4\x93\x02,\x12*/v3/{parent=projects/*/locations/*}/models\x12\x97\x01\n\x08GetModel\x12,.google.cloud.translation.v3.GetModelRequest\x1a\".google.cloud.translation.v3.Model\"9\xda\x41\x04name\x82\xd3\xe4\x93\x02,\x12*/v3/{name=projects/*/locations/*/models/*}\x12\xc7\x01\n\x0b\x44\x65leteModel\x12/.google.cloud.translation.v3.DeleteModelRequest\x1a\x1d.google.longrunning.Operation\"h\xca\x41,\n\x15google.protobuf.Empty\x12\x13\x44\x65leteModelMetadata\xda\x41\x04name\x82\xd3\xe4\x93\x02,**/v3/{name=projects/*/locations/*/models/*}\x1a~\xca\x41\x18translate.googleapis.com\xd2\x41`https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translationB\xd6\x01\n\x1d\x63om.google.cloud.translate.v3B\x17TranslationServiceProtoP\x01Z;cloud.google.com/go/translate/apiv3/translatepb;translatepb\xa2\x02\x05\x43TRL3\xaa\x02\x19Google.Cloud.Translate.V3\xca\x02\x19Google\\Cloud\\Translate\\V3\xea\x02\x1cGoogle::Cloud::Translate::V3P\x00P\x01P\x02\x62\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Translate - module V3 - TransliterationConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TransliterationConfig").msgclass - TranslateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextRequest").msgclass - TranslateTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextResponse").msgclass - Translation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Translation").msgclass - RomanizeTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.RomanizeTextRequest").msgclass - Romanization = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Romanization").msgclass - RomanizeTextResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.RomanizeTextResponse").msgclass - DetectLanguageRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectLanguageRequest").msgclass - DetectedLanguage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectedLanguage").msgclass - DetectLanguageResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DetectLanguageResponse").msgclass - GetSupportedLanguagesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetSupportedLanguagesRequest").msgclass - SupportedLanguages = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.SupportedLanguages").msgclass - SupportedLanguage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.SupportedLanguage").msgclass - GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsSource").msgclass - InputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.InputConfig").msgclass - GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsDestination").msgclass - OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.OutputConfig").msgclass - DocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentInputConfig").msgclass - DocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentOutputConfig").msgclass - TranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentRequest").msgclass - DocumentTranslation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentTranslation").msgclass - TranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentResponse").msgclass - BatchTranslateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateTextRequest").msgclass - BatchTranslateMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata").msgclass - BatchTranslateMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata.State").enummodule - BatchTranslateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateResponse").msgclass - GlossaryInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GlossaryInputConfig").msgclass - Glossary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary").msgclass - Glossary::LanguageCodePair = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary.LanguageCodePair").msgclass - Glossary::LanguageCodesSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.Glossary.LanguageCodesSet").msgclass - CreateGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryRequest").msgclass - UpdateGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryRequest").msgclass - GetGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetGlossaryRequest").msgclass - DeleteGlossaryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryRequest").msgclass - ListGlossariesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossariesRequest").msgclass - ListGlossariesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossariesResponse").msgclass - GetGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GetGlossaryEntryRequest").msgclass - DeleteGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryEntryRequest").msgclass - ListGlossaryEntriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossaryEntriesRequest").msgclass - ListGlossaryEntriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.ListGlossaryEntriesResponse").msgclass - CreateGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryEntryRequest").msgclass - UpdateGlossaryEntryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryEntryRequest").msgclass - CreateGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryMetadata").msgclass - CreateGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.CreateGlossaryMetadata.State").enummodule - UpdateGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryMetadata").msgclass - UpdateGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.UpdateGlossaryMetadata.State").enummodule - DeleteGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata").msgclass - DeleteGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata.State").enummodule - DeleteGlossaryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryResponse").msgclass - BatchTranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentRequest").msgclass - BatchDocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentInputConfig").msgclass - BatchDocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentOutputConfig").msgclass - BatchTranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentResponse").msgclass - BatchTranslateDocumentMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata").msgclass - BatchTranslateDocumentMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata.State").enummodule - TranslateTextGlossaryConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateTextGlossaryConfig").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb deleted file mode 100644 index d7dd9d8ae961..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/translation_service_services_pb.rb +++ /dev/null @@ -1,141 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/translate/v3/translation_service.proto for package 'Google.Cloud.Translate.V3' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. -# - -require 'grpc' -require 'google/cloud/translate/v3/translation_service_pb' - -module Google - module Cloud - module Translate - module V3 - module TranslationService - # Proto file for the Cloud Translation API (v3 GA). - # - # Provides natural language translation operations. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.translation.v3.TranslationService' - - # Translates input text and returns translated text. - rpc :TranslateText, ::Google::Cloud::Translate::V3::TranslateTextRequest, ::Google::Cloud::Translate::V3::TranslateTextResponse - # Romanize input text written in non-Latin scripts to Latin text. - rpc :RomanizeText, ::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Google::Cloud::Translate::V3::RomanizeTextResponse - # Detects the language of text within a request. - rpc :DetectLanguage, ::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Google::Cloud::Translate::V3::DetectLanguageResponse - # Returns a list of supported languages for translation. - rpc :GetSupportedLanguages, ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Google::Cloud::Translate::V3::SupportedLanguages - # Translates documents in synchronous mode. - rpc :TranslateDocument, ::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Google::Cloud::Translate::V3::TranslateDocumentResponse - # 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 - # 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 :BatchTranslateText, ::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Google::Longrunning::Operation - # 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, ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Google::Longrunning::Operation - # Creates a glossary and returns the long-running operation. Returns - # NOT_FOUND, if the project doesn't exist. - rpc :CreateGlossary, ::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Google::Longrunning::Operation - # Updates a glossary. A LRO is used since the update can be async if the - # glossary's entry file is updated. - rpc :UpdateGlossary, ::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Google::Longrunning::Operation - # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - # exist. - rpc :ListGlossaries, ::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Google::Cloud::Translate::V3::ListGlossariesResponse - # Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - # exist. - rpc :GetGlossary, ::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Google::Cloud::Translate::V3::Glossary - # Deletes a glossary, or cancels glossary construction - # if the glossary isn't created yet. - # Returns NOT_FOUND, if the glossary doesn't exist. - rpc :DeleteGlossary, ::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Google::Longrunning::Operation - # Gets a single glossary entry by the given id. - rpc :GetGlossaryEntry, ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry - # List the entries for the glossary. - rpc :ListGlossaryEntries, ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse - # Creates a glossary entry. - rpc :CreateGlossaryEntry, ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry - # Updates a glossary entry. - rpc :UpdateGlossaryEntry, ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Google::Cloud::Translate::V3::GlossaryEntry - # Deletes a single entry from the glossary - rpc :DeleteGlossaryEntry, ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Google::Protobuf::Empty - # Creates a Dataset. - rpc :CreateDataset, ::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Google::Longrunning::Operation - # Gets a Dataset. - rpc :GetDataset, ::Google::Cloud::Translate::V3::GetDatasetRequest, ::Google::Cloud::Translate::V3::Dataset - # Lists datasets. - rpc :ListDatasets, ::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Google::Cloud::Translate::V3::ListDatasetsResponse - # Deletes a dataset and all of its contents. - rpc :DeleteDataset, ::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Google::Longrunning::Operation - # Creates an Adaptive MT dataset. - rpc :CreateAdaptiveMtDataset, ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Google::Cloud::Translate::V3::AdaptiveMtDataset - # Deletes an Adaptive MT dataset, including all its entries and associated - # metadata. - rpc :DeleteAdaptiveMtDataset, ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Google::Protobuf::Empty - # Gets the Adaptive MT dataset. - rpc :GetAdaptiveMtDataset, ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Google::Cloud::Translate::V3::AdaptiveMtDataset - # Lists all Adaptive MT datasets for which the caller has read permission. - rpc :ListAdaptiveMtDatasets, ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse - # Translate text using Adaptive MT. - rpc :AdaptiveMtTranslate, ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse - # Gets and AdaptiveMtFile - rpc :GetAdaptiveMtFile, ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Google::Cloud::Translate::V3::AdaptiveMtFile - # Deletes an AdaptiveMtFile along with its sentences. - rpc :DeleteAdaptiveMtFile, ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Google::Protobuf::Empty - # Imports an AdaptiveMtFile and adds all of its sentences into the - # AdaptiveMtDataset. - rpc :ImportAdaptiveMtFile, ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse - # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. - rpc :ListAdaptiveMtFiles, ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse - # Lists all AdaptiveMtSentences under a given file/dataset. - rpc :ListAdaptiveMtSentences, ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse - # Import sentence pairs into translation Dataset. - rpc :ImportData, ::Google::Cloud::Translate::V3::ImportDataRequest, ::Google::Longrunning::Operation - # Exports dataset's data to the provided output location. - rpc :ExportData, ::Google::Cloud::Translate::V3::ExportDataRequest, ::Google::Longrunning::Operation - # Lists sentence pairs in the dataset. - rpc :ListExamples, ::Google::Cloud::Translate::V3::ListExamplesRequest, ::Google::Cloud::Translate::V3::ListExamplesResponse - # Creates a Model. - rpc :CreateModel, ::Google::Cloud::Translate::V3::CreateModelRequest, ::Google::Longrunning::Operation - # Lists models. - rpc :ListModels, ::Google::Cloud::Translate::V3::ListModelsRequest, ::Google::Cloud::Translate::V3::ListModelsResponse - # Gets a model. - rpc :GetModel, ::Google::Cloud::Translate::V3::GetModelRequest, ::Google::Cloud::Translate::V3::Model - # Deletes a model. - rpc :DeleteModel, ::Google::Cloud::Translate::V3::DeleteModelRequest, ::Google::Longrunning::Operation - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb b/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb deleted file mode 100644 index dacb619abd34..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/lib/google/cloud/translate/v3/version.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - VERSION = "0.0.1" - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md b/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md deleted file mode 100644 index 4a5eb6a2d169..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Cloud Translation V3 Protocol Buffer Documentation - -These files are for the YARD documentation of the generated protobuf files. -They are not intended to be required or loaded at runtime. diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb deleted file mode 100644 index 3ab0b096d445..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/client.rb +++ /dev/null @@ -1,593 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # Required information for every language. - # @!attribute [rw] reference_docs_uri - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::String] - # Link to automatically generated reference documentation. Example: - # https://cloud.google.com/nodejs/docs/reference/asset/latest - # @!attribute [rw] destinations - # @return [::Array<::Google::Api::ClientLibraryDestination>] - # The destination where API teams want this client library to be published. - # @!attribute [rw] selective_gapic_generation - # @return [::Google::Api::SelectiveGapicGeneration] - # Configuration for which RPCs should be generated in the GAPIC client. - # - # Note: This field should not be used in most cases. - class CommonLanguageSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Details about how and where to publish client libraries. - # @!attribute [rw] version - # @return [::String] - # Version of the API to apply these settings to. This is the full protobuf - # package for the API, ending in the version element. - # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". - # @!attribute [rw] launch_stage - # @return [::Google::Api::LaunchStage] - # Launch stage of this version of the API. - # @!attribute [rw] rest_numeric_enums - # @return [::Boolean] - # When using transport=rest, the client request will encode enums as - # numbers rather than strings. - # @!attribute [rw] java_settings - # @return [::Google::Api::JavaSettings] - # Settings for legacy Java features, supported in the Service YAML. - # @!attribute [rw] cpp_settings - # @return [::Google::Api::CppSettings] - # Settings for C++ client libraries. - # @!attribute [rw] php_settings - # @return [::Google::Api::PhpSettings] - # Settings for PHP client libraries. - # @!attribute [rw] python_settings - # @return [::Google::Api::PythonSettings] - # Settings for Python client libraries. - # @!attribute [rw] node_settings - # @return [::Google::Api::NodeSettings] - # Settings for Node client libraries. - # @!attribute [rw] dotnet_settings - # @return [::Google::Api::DotnetSettings] - # Settings for .NET client libraries. - # @!attribute [rw] ruby_settings - # @return [::Google::Api::RubySettings] - # Settings for Ruby client libraries. - # @!attribute [rw] go_settings - # @return [::Google::Api::GoSettings] - # Settings for Go client libraries. - class ClientLibrarySettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This message configures the settings for publishing [Google Cloud Client - # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) - # generated from the service config. - # @!attribute [rw] method_settings - # @return [::Array<::Google::Api::MethodSettings>] - # A list of API method settings, e.g. the behavior for methods that use the - # long-running operation pattern. - # @!attribute [rw] new_issue_uri - # @return [::String] - # Link to a *public* URI where users can report issues. Example: - # https://issuetracker.google.com/issues/new?component=190865&template=1161103 - # @!attribute [rw] documentation_uri - # @return [::String] - # Link to product home page. Example: - # https://cloud.google.com/asset-inventory/docs/overview - # @!attribute [rw] api_short_name - # @return [::String] - # Used as a tracking tag when collecting data about the APIs developer - # relations artifacts like docs, packages delivered to package managers, - # etc. Example: "speech". - # @!attribute [rw] github_label - # @return [::String] - # GitHub label to apply to issues and pull requests opened for this API. - # @!attribute [rw] codeowner_github_teams - # @return [::Array<::String>] - # GitHub teams to be added to CODEOWNERS in the directory in GitHub - # containing source code for the client libraries for this API. - # @!attribute [rw] doc_tag_prefix - # @return [::String] - # A prefix used in sample code when demarking regions to be included in - # documentation. - # @!attribute [rw] organization - # @return [::Google::Api::ClientLibraryOrganization] - # For whom the client library is being published. - # @!attribute [rw] library_settings - # @return [::Array<::Google::Api::ClientLibrarySettings>] - # Client library settings. If the same version string appears multiple - # times in this list, then the last one wins. Settings from earlier - # settings with the same version string are discarded. - # @!attribute [rw] proto_reference_documentation_uri - # @return [::String] - # Optional link to proto reference documentation. Example: - # https://cloud.google.com/pubsub/lite/docs/reference/rpc - # @!attribute [rw] rest_reference_documentation_uri - # @return [::String] - # Optional link to REST reference documentation. Example: - # https://cloud.google.com/pubsub/lite/docs/reference/rest - class Publishing - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Java client libraries. - # @!attribute [rw] library_package - # @return [::String] - # The package name to use in Java. Clobbers the java_package option - # set in the protobuf. This should be used **only** by APIs - # who have already set the language_settings.java.package_name" field - # in gapic.yaml. API teams should use the protobuf java_package option - # where possible. - # - # Example of a YAML configuration:: - # - # publishing: - # library_settings: - # java_settings: - # library_package: com.google.cloud.pubsub.v1 - # @!attribute [rw] service_class_names - # @return [::Google::Protobuf::Map{::String => ::String}] - # Configure the Java class name to use instead of the service's for its - # corresponding generated GAPIC client. Keys are fully-qualified - # service names as they appear in the protobuf (including the full - # the language_settings.java.interface_names" field in gapic.yaml. API - # teams should otherwise use the service name as it appears in the - # protobuf. - # - # Example of a YAML configuration:: - # - # publishing: - # java_settings: - # service_class_names: - # - google.pubsub.v1.Publisher: TopicAdmin - # - google.pubsub.v1.Subscriber: SubscriptionAdmin - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class JavaSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class ServiceClassNamesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for C++ client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class CppSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Php client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] library_package - # @return [::String] - # The package name to use in Php. Clobbers the php_namespace option - # set in the protobuf. This should be used **only** by APIs - # who have already set the language_settings.php.package_name" field - # in gapic.yaml. API teams should use the protobuf php_namespace option - # where possible. - # - # Example of a YAML configuration:: - # - # publishing: - # library_settings: - # php_settings: - # library_package: Google\Cloud\PubSub\V1 - class PhpSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Python client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] experimental_features - # @return [::Google::Api::PythonSettings::ExperimentalFeatures] - # Experimental features to be included during client library generation. - class PythonSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Experimental features to be included during client library generation. - # These fields will be deprecated once the feature graduates and is enabled - # by default. - # @!attribute [rw] rest_async_io_enabled - # @return [::Boolean] - # Enables generation of asynchronous REST clients if `rest` transport is - # enabled. By default, asynchronous REST clients will not be generated. - # This feature will be enabled by default 1 month after launching the - # feature in preview packages. - # @!attribute [rw] protobuf_pythonic_types_enabled - # @return [::Boolean] - # Enables generation of protobuf code using new types that are more - # Pythonic which are included in `protobuf>=5.29.x`. This feature will be - # enabled by default 1 month after launching the feature in preview - # packages. - # @!attribute [rw] unversioned_package_disabled - # @return [::Boolean] - # Disables generation of an unversioned Python package for this client - # library. This means that the module names will need to be versioned in - # import statements. For example `import google.cloud.library_v2` instead - # of `import google.cloud.library`. - class ExperimentalFeatures - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for Node client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class NodeSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Dotnet client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] renamed_services - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map from original service names to renamed versions. - # This is used when the default generated types - # would cause a naming conflict. (Neither name is - # fully-qualified.) - # Example: Subscriber to SubscriberServiceApi. - # @!attribute [rw] renamed_resources - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map from full resource types to the effective short name - # for the resource. This is used when otherwise resource - # named from different services would cause naming collisions. - # Example entry: - # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" - # @!attribute [rw] ignored_resources - # @return [::Array<::String>] - # List of full resource types to ignore during generation. - # This is typically used for API-specific Location resources, - # which should be handled by the generator as if they were actually - # the common Location resources. - # Example entry: "documentai.googleapis.com/Location" - # @!attribute [rw] forced_namespace_aliases - # @return [::Array<::String>] - # Namespaces which must be aliased in snippets due to - # a known (but non-generator-predictable) naming collision - # @!attribute [rw] handwritten_signatures - # @return [::Array<::String>] - # Method signatures (in the form "service.method(signature)") - # which are provided separately, so shouldn't be generated. - # Snippets *calling* these methods are still generated, however. - class DotnetSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedServicesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedResourcesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for Ruby client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class RubySettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Go client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] renamed_services - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map of service names to renamed services. Keys are the package relative - # service names and values are the name to be used for the service client - # and call options. - # - # Example: - # - # publishing: - # go_settings: - # renamed_services: - # Publisher: TopicAdmin - class GoSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedServicesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Describes the generator configuration for a method. - # @!attribute [rw] selector - # @return [::String] - # The fully qualified name of the method, for which the options below apply. - # This is used to find the method to apply the options. - # - # Example: - # - # publishing: - # method_settings: - # - selector: google.storage.control.v2.StorageControl.CreateFolder - # # method settings for CreateFolder... - # @!attribute [rw] long_running - # @return [::Google::Api::MethodSettings::LongRunning] - # Describes settings to use for long-running operations when generating - # API methods for RPCs. Complements RPCs that use the annotations in - # google/longrunning/operations.proto. - # - # Example of a YAML configuration:: - # - # publishing: - # method_settings: - # - selector: google.cloud.speech.v2.Speech.BatchRecognize - # long_running: - # initial_poll_delay: 60s # 1 minute - # poll_delay_multiplier: 1.5 - # max_poll_delay: 360s # 6 minutes - # total_poll_timeout: 54000s # 90 minutes - # @!attribute [rw] auto_populated_fields - # @return [::Array<::String>] - # List of top-level fields of the request message, that should be - # automatically populated by the client libraries based on their - # (google.api.field_info).format. Currently supported format: UUID4. - # - # Example of a YAML configuration: - # - # publishing: - # method_settings: - # - selector: google.example.v1.ExampleService.CreateExample - # auto_populated_fields: - # - request_id - # @!attribute [rw] batching - # @return [::Google::Api::BatchingConfigProto] - # Batching configuration for an API method in client libraries. - # - # Example of a YAML configuration: - # - # publishing: - # method_settings: - # - selector: google.example.v1.ExampleService.BatchCreateExample - # batching: - # element_count_threshold: 1000 - # request_byte_threshold: 100000000 - # delay_threshold_millis: 10 - class MethodSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Describes settings to use when generating API methods that use the - # long-running operation pattern. - # All default values below are from those used in the client library - # generators (e.g. - # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). - # @!attribute [rw] initial_poll_delay - # @return [::Google::Protobuf::Duration] - # Initial delay after which the first poll request will be made. - # Default value: 5 seconds. - # @!attribute [rw] poll_delay_multiplier - # @return [::Float] - # Multiplier to gradually increase delay between subsequent polls until it - # reaches max_poll_delay. - # Default value: 1.5. - # @!attribute [rw] max_poll_delay - # @return [::Google::Protobuf::Duration] - # Maximum time between two subsequent poll requests. - # Default value: 45 seconds. - # @!attribute [rw] total_poll_timeout - # @return [::Google::Protobuf::Duration] - # Total polling timeout. - # Default value: 5 minutes. - class LongRunning - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # This message is used to configure the generation of a subset of the RPCs in - # a service for client libraries. - # - # Note: This feature should not be used in most cases. - # @!attribute [rw] methods - # @return [::Array<::String>] - # An allowlist of the fully qualified names of RPCs that should be included - # on public client surfaces. - # @!attribute [rw] generate_omitted_as_internal - # @return [::Boolean] - # Setting this to true indicates to the client generators that methods - # that would be excluded from the generation should instead be generated - # in a way that indicates these methods should not be consumed by - # end users. How this is expressed is up to individual language - # implementations to decide. Some examples may be: added annotations, - # obfuscated identifiers, or other language idiomatic patterns. - class SelectiveGapicGeneration - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingConfigProto` defines the batching configuration for an API method. - # @!attribute [rw] thresholds - # @return [::Google::Api::BatchingSettingsProto] - # The thresholds which trigger a batched request to be sent. - # @!attribute [rw] batch_descriptor - # @return [::Google::Api::BatchingDescriptorProto] - # The request and response fields used in batching. - class BatchingConfigProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingSettingsProto` specifies a set of batching thresholds, each of - # which acts as a trigger to send a batch of messages as a request. At least - # one threshold must be positive nonzero. - # @!attribute [rw] element_count_threshold - # @return [::Integer] - # The number of elements of a field collected into a batch which, if - # exceeded, causes the batch to be sent. - # @!attribute [rw] request_byte_threshold - # @return [::Integer] - # The aggregated size of the batched field which, if exceeded, causes the - # batch to be sent. This size is computed by aggregating the sizes of the - # request field to be batched, not of the entire request message. - # @!attribute [rw] delay_threshold - # @return [::Google::Protobuf::Duration] - # The duration after which a batch should be sent, starting from the addition - # of the first message to that batch. - # @!attribute [rw] element_count_limit - # @return [::Integer] - # The maximum number of elements collected in a batch that could be accepted - # by server. - # @!attribute [rw] request_byte_limit - # @return [::Integer] - # The maximum size of the request that could be accepted by server. - # @!attribute [rw] flow_control_element_limit - # @return [::Integer] - # The maximum number of elements allowed by flow control. - # @!attribute [rw] flow_control_byte_limit - # @return [::Integer] - # The maximum size of data allowed by flow control. - # @!attribute [rw] flow_control_limit_exceeded_behavior - # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] - # The behavior to take when the flow control limit is exceeded. - class BatchingSettingsProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingDescriptorProto` specifies the fields of the request message to be - # used for batching, and, optionally, the fields of the response message to be - # used for demultiplexing. - # @!attribute [rw] batched_field - # @return [::String] - # The repeated field in the request message to be aggregated by batching. - # @!attribute [rw] discriminator_fields - # @return [::Array<::String>] - # A list of the fields in the request message. Two requests will be batched - # together only if the values of every field specified in - # `request_discriminator_fields` is equal between the two requests. - # @!attribute [rw] subresponse_field - # @return [::String] - # Optional. When present, indicates the field in the response message to be - # used to demultiplex the response into multiple response messages, in - # correspondence with the multiple request messages originally batched - # together. - class BatchingDescriptorProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The organization for which the client libraries are being published. - # Affects the url where generated docs are published, etc. - module ClientLibraryOrganization - # Not useful. - CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 - - # Google Cloud Platform Org. - CLOUD = 1 - - # Ads (Advertising) Org. - ADS = 2 - - # Photos Org. - PHOTOS = 3 - - # Street View Org. - STREET_VIEW = 4 - - # Shopping Org. - SHOPPING = 5 - - # Geo Org. - GEO = 6 - - # Generative AI - https://developers.generativeai.google - GENERATIVE_AI = 7 - end - - # To where should client libraries be published? - module ClientLibraryDestination - # Client libraries will neither be generated nor published to package - # managers. - CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 - - # Generate the client library in a repo under github.com/googleapis, - # but don't publish it to package managers. - GITHUB = 10 - - # Publish the library to package managers like nuget.org and npmjs.com. - PACKAGE_MANAGER = 20 - end - - # The behavior to take when the flow control limit is exceeded. - module FlowControlLimitExceededBehaviorProto - # Default behavior, system-defined. - UNSET_BEHAVIOR = 0 - - # Stop operation, raise error. - THROW_EXCEPTION = 1 - - # Pause operation until limit clears. - BLOCK = 2 - - # Continue operation, disregard limit. - IGNORE = 3 - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb deleted file mode 100644 index 582be187d115..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/field_behavior.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # An indicator of the behavior of a given field (for example, that a field - # is required in requests, or given as output but ignored as input). - # This **does not** change the behavior in protocol buffers itself; it only - # denotes the behavior and may affect how API tooling handles the field. - # - # Note: This enum **may** receive new values in the future. - module FieldBehavior - # Conventional default for enums. Do not use this. - FIELD_BEHAVIOR_UNSPECIFIED = 0 - - # Specifically denotes a field as optional. - # While all fields in protocol buffers are optional, this may be specified - # for emphasis if appropriate. - OPTIONAL = 1 - - # Denotes a field as required. - # This indicates that the field **must** be provided as part of the request, - # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - REQUIRED = 2 - - # Denotes a field as output only. - # This indicates that the field is provided in responses, but including the - # field in a request does nothing (the server *must* ignore it and - # *must not* throw an error as a result of the field's presence). - OUTPUT_ONLY = 3 - - # Denotes a field as input only. - # This indicates that the field is provided in requests, and the - # corresponding field is not included in output. - INPUT_ONLY = 4 - - # Denotes a field as immutable. - # This indicates that the field may be set once in a request to create a - # resource, but may not be changed thereafter. - IMMUTABLE = 5 - - # Denotes that a (repeated) field is an unordered list. - # This indicates that the service may provide the elements of the list - # in any arbitrary order, rather than the order the user originally - # provided. Additionally, the list's order may or may not be stable. - UNORDERED_LIST = 6 - - # Denotes that this field returns a non-empty default value if not set. - # This indicates that if the user provides the empty value in a request, - # a non-empty value will be returned. The user will not be aware of what - # non-empty value to expect. - NON_EMPTY_DEFAULT = 7 - - # Denotes that the field in a resource (a message annotated with - # google.api.resource) is used in the resource name to uniquely identify the - # resource. For AIP-compliant APIs, this should only be applied to the - # `name` field on the resource. - # - # This behavior should not be applied to references to other resources within - # the message. - # - # The identifier field of resources often have different field behavior - # depending on the request it is embedded in (e.g. for Create methods name - # is optional and unused, while for Update methods it is required). Instead - # of method-specific annotations, only `IDENTIFIER` is required. - IDENTIFIER = 8 - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb deleted file mode 100644 index 9392a413fb1b..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/launch_stage.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # The launch stage as defined by [Google Cloud Platform - # Launch Stages](https://cloud.google.com/terms/launch-stages). - module LaunchStage - # Do not use this default value. - LAUNCH_STAGE_UNSPECIFIED = 0 - - # The feature is not yet implemented. Users can not use it. - UNIMPLEMENTED = 6 - - # Prelaunch features are hidden from users and are only visible internally. - PRELAUNCH = 7 - - # Early Access features are limited to a closed group of testers. To use - # these features, you must sign up in advance and sign a Trusted Tester - # agreement (which includes confidentiality provisions). These features may - # be unstable, changed in backward-incompatible ways, and are not - # guaranteed to be released. - EARLY_ACCESS = 1 - - # Alpha is a limited availability test for releases before they are cleared - # for widespread use. By Alpha, all significant design issues are resolved - # and we are in the process of verifying functionality. Alpha customers - # need to apply for access, agree to applicable terms, and have their - # projects allowlisted. Alpha releases don't have to be feature complete, - # no SLAs are provided, and there are no technical support obligations, but - # they will be far enough along that customers can actually use them in - # test environments or for limited-use tests -- just like they would in - # normal production cases. - ALPHA = 2 - - # Beta is the point at which we are ready to open a release for any - # customer to use. There are no SLA or technical support obligations in a - # Beta release. Products will be complete from a feature perspective, but - # may have some open outstanding issues. Beta releases are suitable for - # limited production use cases. - BETA = 3 - - # GA features are open to all developers and are considered stable and - # fully qualified for production use. - GA = 4 - - # Deprecated features are scheduled to be shut down and removed. For more - # information, see the "Deprecation Policy" section of our [Terms of - # Service](https://cloud.google.com/terms/) - # and the [Google Cloud Platform Subject to the Deprecation - # Policy](https://cloud.google.com/terms/deprecation) documentation. - DEPRECATED = 5 - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb deleted file mode 100644 index 25dec4847ac1..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/api/resource.rb +++ /dev/null @@ -1,227 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # A simple descriptor of a resource type. - # - # ResourceDescriptor annotates a resource message (either by means of a - # protobuf annotation or use in the service config), and associates the - # resource's schema, the resource type, and the pattern of the resource name. - # - # Example: - # - # message Topic { - # // Indicates this message defines a resource schema. - # // Declares the resource type in the format of {service}/{kind}. - # // For Kubernetes resources, the format is {api group}/{kind}. - # option (google.api.resource) = { - # type: "pubsub.googleapis.com/Topic" - # pattern: "projects/{project}/topics/{topic}" - # }; - # } - # - # The ResourceDescriptor Yaml config will look like: - # - # resources: - # - type: "pubsub.googleapis.com/Topic" - # pattern: "projects/{project}/topics/{topic}" - # - # Sometimes, resources have multiple patterns, typically because they can - # live under multiple parents. - # - # Example: - # - # message LogEntry { - # option (google.api.resource) = { - # type: "logging.googleapis.com/LogEntry" - # pattern: "projects/{project}/logs/{log}" - # pattern: "folders/{folder}/logs/{log}" - # pattern: "organizations/{organization}/logs/{log}" - # pattern: "billingAccounts/{billing_account}/logs/{log}" - # }; - # } - # - # The ResourceDescriptor Yaml config will look like: - # - # resources: - # - type: 'logging.googleapis.com/LogEntry' - # pattern: "projects/{project}/logs/{log}" - # pattern: "folders/{folder}/logs/{log}" - # pattern: "organizations/{organization}/logs/{log}" - # pattern: "billingAccounts/{billing_account}/logs/{log}" - # @!attribute [rw] type - # @return [::String] - # The resource type. It must be in the format of - # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be - # singular and must not include version numbers. - # - # Example: `storage.googleapis.com/Bucket` - # - # The value of the resource_type_kind must follow the regular expression - # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and - # should use PascalCase (UpperCamelCase). The maximum number of - # characters allowed for the `resource_type_kind` is 100. - # @!attribute [rw] pattern - # @return [::Array<::String>] - # Optional. The relative resource name pattern associated with this resource - # type. The DNS prefix of the full resource name shouldn't be specified here. - # - # The path pattern must follow the syntax, which aligns with HTTP binding - # syntax: - # - # Template = Segment { "/" Segment } ; - # Segment = LITERAL | Variable ; - # Variable = "{" LITERAL "}" ; - # - # Examples: - # - # - "projects/\\{project}/topics/\\{topic}" - # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" - # - # The components in braces correspond to the IDs for each resource in the - # hierarchy. It is expected that, if multiple patterns are provided, - # the same component name (e.g. "project") refers to IDs of the same - # type of resource. - # @!attribute [rw] name_field - # @return [::String] - # Optional. The field on the resource that designates the resource name - # field. If omitted, this is assumed to be "name". - # @!attribute [rw] history - # @return [::Google::Api::ResourceDescriptor::History] - # Optional. The historical or future-looking state of the resource pattern. - # - # Example: - # - # // The InspectTemplate message originally only supported resource - # // names with organization, and project was added later. - # message InspectTemplate { - # option (google.api.resource) = { - # type: "dlp.googleapis.com/InspectTemplate" - # pattern: - # "organizations/{organization}/inspectTemplates/{inspect_template}" - # pattern: "projects/{project}/inspectTemplates/{inspect_template}" - # history: ORIGINALLY_SINGLE_PATTERN - # }; - # } - # @!attribute [rw] plural - # @return [::String] - # The plural name used in the resource name and permission names, such as - # 'projects' for the resource name of 'projects/\\{project}' and the permission - # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception - # to this is for Nested Collections that have stuttering names, as defined - # in [AIP-122](https://google.aip.dev/122#nested-collections), where the - # collection ID in the resource name pattern does not necessarily directly - # match the `plural` value. - # - # It is the same concept of the `plural` field in k8s CRD spec - # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - # - # Note: The plural form is required even for singleton resources. See - # https://aip.dev/156 - # @!attribute [rw] singular - # @return [::String] - # The same concept of the `singular` field in k8s CRD spec - # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - # Such as "project" for the `resourcemanager.googleapis.com/Project` type. - # @!attribute [rw] style - # @return [::Array<::Google::Api::ResourceDescriptor::Style>] - # Style flag(s) for this resource. - # These indicate that a resource is expected to conform to a given - # style. See the specific style flags for additional information. - class ResourceDescriptor - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A description of the historical or future-looking state of the - # resource pattern. - module History - # The "unset" value. - HISTORY_UNSPECIFIED = 0 - - # The resource originally had one pattern and launched as such, and - # additional patterns were added later. - ORIGINALLY_SINGLE_PATTERN = 1 - - # The resource has one pattern, but the API owner expects to add more - # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents - # that from being necessary once there are multiple patterns.) - FUTURE_MULTI_PATTERN = 2 - end - - # A flag representing a specific style that a resource claims to conform to. - module Style - # The unspecified value. Do not use. - STYLE_UNSPECIFIED = 0 - - # This resource is intended to be "declarative-friendly". - # - # Declarative-friendly resources must be more strictly consistent, and - # setting this to true communicates to tools that this resource should - # adhere to declarative-friendly expectations. - # - # Note: This is used by the API linter (linter.aip.dev) to enable - # additional checks. - DECLARATIVE_FRIENDLY = 1 - end - end - - # Defines a proto annotation that describes a string field that refers to - # an API resource. - # @!attribute [rw] type - # @return [::String] - # The resource type that the annotated field references. - # - # Example: - # - # message Subscription { - # string topic = 2 [(google.api.resource_reference) = { - # type: "pubsub.googleapis.com/Topic" - # }]; - # } - # - # Occasionally, a field may reference an arbitrary resource. In this case, - # APIs use the special value * in their resource reference. - # - # Example: - # - # message GetIamPolicyRequest { - # string resource = 2 [(google.api.resource_reference) = { - # type: "*" - # }]; - # } - # @!attribute [rw] child_type - # @return [::String] - # The resource type of a child collection that the annotated field - # references. This is useful for annotating the `parent` field that - # doesn't have a fixed resource type. - # - # Example: - # - # message ListLogEntriesRequest { - # string parent = 1 [(google.api.resource_reference) = { - # child_type: "logging.googleapis.com/LogEntry" - # }; - # } - class ResourceReference - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb deleted file mode 100644 index c572fd4b8154..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/adaptive_mt.rb +++ /dev/null @@ -1,408 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - # An Adaptive MT Dataset. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the dataset, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` - # @!attribute [rw] display_name - # @return [::String] - # The name of the dataset to show in the interface. The name can be - # up to 32 characters long and can consist only of ASCII Latin letters A-Z - # and a-z, underscores (_), and ASCII digits 0-9. - # @!attribute [rw] source_language_code - # @return [::String] - # The BCP-47 language code of the source language. - # @!attribute [rw] target_language_code - # @return [::String] - # The BCP-47 language code of the target language. - # @!attribute [rw] example_count - # @return [::Integer] - # The number of examples in the dataset. - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this dataset was created. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this dataset was last updated. - class AdaptiveMtDataset - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - #  Request message for creating an AdaptiveMtDataset. - # @!attribute [rw] parent - # @return [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @!attribute [rw] adaptive_mt_dataset - # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset] - # Required. The AdaptiveMtDataset to be created. - class CreateAdaptiveMtDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for deleting an AdaptiveMtDataset. - # @!attribute [rw] name - # @return [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - class DeleteAdaptiveMtDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for getting an Adaptive MT dataset. - # @!attribute [rw] name - # @return [::String] - # Required. Name of the dataset. In the form of - # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` - class GetAdaptiveMtDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for listing all Adaptive MT datasets that the requestor has - # access to. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT datasets. `projects/{project-number-or-id}/locations/{location-id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server may return fewer results than - # requested. If unspecified, the server picks an appropriate default. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtDatasetsResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtDatasets` method. The first page is - # returned if `page_token`is empty or missing. - # @!attribute [rw] filter - # @return [::String] - # Optional. An expression for filtering the results of the request. - # Filter is not supported yet. - class ListAdaptiveMtDatasetsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A list of AdaptiveMtDatasets. - # @!attribute [r] adaptive_mt_datasets - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtDataset>] - # Output only. A list of Adaptive MT datasets. - # @!attribute [rw] next_page_token - # @return [::String] - # Optional. A token to retrieve a page of results. Pass this value in the - # [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to - # `ListAdaptiveMtDatasets` method to retrieve the next page of results. - class ListAdaptiveMtDatasetsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request for sending an AdaptiveMt translation query. - # @!attribute [rw] parent - # @return [::String] - # Required. Location to make a regional call. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # @!attribute [rw] dataset - # @return [::String] - # Required. The resource name for the dataset to use for adaptive MT. - # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` - # @!attribute [rw] content - # @return [::Array<::String>] - # Required. The content of the input in string format. - # @!attribute [rw] mime_type - # @return [::String] - # The format of the source text. - # @!attribute [rw] reference_sentence_config - # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig] - # Configuration for caller provided reference sentences. - # @!attribute [rw] glossary_config - # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::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. - class AdaptiveMtTranslateRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A pair of sentences used as reference in source and target languages. - # @!attribute [rw] source_sentence - # @return [::String] - # Source sentence in the sentence pair. - # @!attribute [rw] target_sentence - # @return [::String] - # Target sentence in the sentence pair. - class ReferenceSentencePair - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A list of reference sentence pairs. - # @!attribute [rw] reference_sentence_pairs - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentencePair>] - # Reference sentence pairs. - class ReferenceSentencePairList - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Message of caller-provided reference configuration. - # @!attribute [rw] reference_sentence_pair_lists - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentencePairList>] - # Reference sentences pair lists. Each list will be used as the references - # to translate the sentence under "content" field at the corresponding - # index. Length of the list is required to be equal to the length of - # "content" field. - # @!attribute [rw] source_language_code - # @return [::String] - # Source language code. - # @!attribute [rw] target_language_code - # @return [::String] - # Target language code. - class ReferenceSentenceConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Configures which glossary is used for a specific target language and - # defines - # options for applying that glossary. - # @!attribute [rw] glossary - # @return [::String] - # Required. The `glossary` to be applied for this translation. - # - # The format depends on the glossary: - # - # - User-provided custom glossary: - # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - # @!attribute [rw] ignore_case - # @return [::Boolean] - # Optional. Indicates match is case insensitive. The default value is - # `false` if missing. - # @!attribute [rw] contextual_translation_enabled - # @return [::Boolean] - # Optional. If set to true, the glossary will be used for contextual - # translation. - class GlossaryConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # An AdaptiveMt translation. - # @!attribute [r] translated_text - # @return [::String] - # Output only. The translated text. - class AdaptiveMtTranslation - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # An AdaptiveMtTranslate response. - # @!attribute [r] translations - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslation>] - # Output only. The translation. - # @!attribute [r] language_code - # @return [::String] - # Output only. The translation's language code. - # @!attribute [rw] glossary_translations - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtTranslation>] - # Text translation response if a glossary is provided in the request. This - # could be the same as 'translation' above if no terms apply. - class AdaptiveMtTranslateResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # An AdaptiveMtFile. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # @!attribute [rw] display_name - # @return [::String] - # The file's display name. - # @!attribute [rw] entry_count - # @return [::Integer] - # The number of entries that the file contains. - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this file was created. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this file was last updated. - class AdaptiveMtFile - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request for getting an AdaptiveMtFile. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - class GetAdaptiveMtFileRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request for deleting an AdaptiveMt file. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the file to delete, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - class DeleteAdaptiveMtFileRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request for importing an AdaptiveMt file along with its sentences. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` - # @!attribute [rw] file_input_source - # @return [::Google::Cloud::Translate::V3::FileInputSource] - # Inline file source. - # - # Note: The following fields are mutually exclusive: `file_input_source`, `gcs_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] gcs_input_source - # @return [::Google::Cloud::Translate::V3::GcsInputSource] - # Google Cloud Storage file source. - # - # Note: The following fields are mutually exclusive: `gcs_input_source`, `file_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class ImportAdaptiveMtFileRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response for importing an AdaptiveMtFile - # @!attribute [r] adaptive_mt_file - # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile] - # Output only. The Adaptive MT file that was imported. - class ImportAdaptiveMtFileResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request to list all AdaptiveMt files under a given dataset. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtFilesResponse.next_page_token returned from the - # previous call to `ListAdaptiveMtFiles` method. The first page is - # returned if `page_token`is empty or missing. - class ListAdaptiveMtFilesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response for listing all AdaptiveMt files under a given dataset. - # @!attribute [r] adaptive_mt_files - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtFile>] - # Output only. The Adaptive MT files. - # @!attribute [rw] next_page_token - # @return [::String] - # Optional. A token to retrieve a page of results. Pass this value in the - # ListAdaptiveMtFilesRequest.page_token field in the subsequent call to - # `ListAdaptiveMtFiles` method to retrieve the next page of results. - class ListAdaptiveMtFilesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # An AdaptiveMt sentence entry. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the file, in form of - # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` - # @!attribute [rw] source_sentence - # @return [::String] - # Required. The source sentence. - # @!attribute [rw] target_sentence - # @return [::String] - # Required. The target sentence. - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this sentence was created. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this sentence was last updated. - class AdaptiveMtSentence - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request for listing Adaptive MT sentences from a Dataset/File. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the project from which to list the Adaptive - # MT files. The following format lists all sentences under a file. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` - # The following format lists all sentences within a dataset. - # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` - # @!attribute [rw] page_size - # @return [::Integer] - # @!attribute [rw] page_token - # @return [::String] - # A token identifying a page of results the server should return. - # Typically, this is the value of - # ListAdaptiveMtSentencesRequest.next_page_token returned from the - # previous call to `ListTranslationMemories` method. The first page is - # returned if `page_token` is empty or missing. - class ListAdaptiveMtSentencesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # List AdaptiveMt sentences response. - # @!attribute [r] adaptive_mt_sentences - # @return [::Array<::Google::Cloud::Translate::V3::AdaptiveMtSentence>] - # Output only. The list of AdaptiveMtSentences. - # @!attribute [rw] next_page_token - # @return [::String] - # Optional. - class ListAdaptiveMtSentencesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb deleted file mode 100644 index 0c1912d9abd3..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/automl_translation.rb +++ /dev/null @@ -1,487 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - # Request message for ImportData. - # @!attribute [rw] dataset - # @return [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @!attribute [rw] input_config - # @return [::Google::Cloud::Translate::V3::DatasetInputConfig] - # Required. The config for the input content. - class ImportDataRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Input configuration for datasets. - # @!attribute [rw] input_files - # @return [::Array<::Google::Cloud::Translate::V3::DatasetInputConfig::InputFile>] - # Files containing the sentence pairs to be imported to the dataset. - class DatasetInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # An input file. - # @!attribute [rw] usage - # @return [::String] - # Optional. Usage of the file contents. Options are TRAIN|VALIDATION|TEST, - # or UNASSIGNED (by default) for auto split. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Translate::V3::GcsInputSource] - # Google Cloud Storage file source. - class InputFile - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Metadata of import data operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class ImportDataMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ExportData. - # @!attribute [rw] dataset - # @return [::String] - # Required. Name of the dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @!attribute [rw] output_config - # @return [::Google::Cloud::Translate::V3::DatasetOutputConfig] - # Required. The config for the output content. - class ExportDataRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Output configuration for datasets. - # @!attribute [rw] gcs_destination - # @return [::Google::Cloud::Translate::V3::GcsOutputDestination] - # Google Cloud Storage destination to write the output. - class DatasetOutputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata of export data operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class ExportDataMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for DeleteDataset. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the dataset to delete. - class DeleteDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata of delete dataset operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class DeleteDatasetMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for GetDataset. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the dataset to retrieve. - class GetDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ListDatasets. - # @!attribute [rw] parent - # @return [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListDatasets call. - class ListDatasetsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for ListDatasets. - # @!attribute [rw] datasets - # @return [::Array<::Google::Cloud::Translate::V3::Dataset>] - # The datasets read. - # @!attribute [rw] next_page_token - # @return [::String] - # A token to retrieve next page of results. - # Pass this token to the page_token field in the ListDatasetsRequest to - # obtain the corresponding page. - class ListDatasetsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for CreateDataset. - # @!attribute [rw] parent - # @return [::String] - # Required. The project name. - # @!attribute [rw] dataset - # @return [::Google::Cloud::Translate::V3::Dataset] - # Required. The Dataset to create. - class CreateDatasetRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata of create dataset operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class CreateDatasetMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ListExamples. - # @!attribute [rw] parent - # @return [::String] - # Required. Name of the parent dataset. In form of - # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}` - # @!attribute [rw] filter - # @return [::String] - # Optional. An expression for filtering the examples that will be returned. - # Example filter: - # * `usage=TRAIN` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListExamples call. - class ListExamplesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for ListExamples. - # @!attribute [rw] examples - # @return [::Array<::Google::Cloud::Translate::V3::Example>] - # The sentence pairs. - # @!attribute [rw] next_page_token - # @return [::String] - # A token to retrieve next page of results. - # Pass this token to the page_token field in the ListExamplesRequest to - # obtain the corresponding page. - class ListExamplesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A sentence pair. - # @!attribute [r] name - # @return [::String] - # Output only. The resource name of the example, in form of - # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}/examples/{example_id}` - # @!attribute [rw] source_text - # @return [::String] - # Sentence in source language. - # @!attribute [rw] target_text - # @return [::String] - # Sentence in target language. - # @!attribute [r] usage - # @return [::String] - # Output only. Usage of the sentence pair. Options are TRAIN|VALIDATION|TEST. - class Example - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for BatchTransferResources. - # @!attribute [rw] responses - # @return [::Array<::Google::Cloud::Translate::V3::BatchTransferResourcesResponse::TransferResourceResponse>] - # Responses of the transfer for individual resources. - class BatchTransferResourcesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Transfer response for a single resource. - # @!attribute [rw] source - # @return [::String] - # Full name of the resource to transfer as specified in the request. - # @!attribute [rw] target - # @return [::String] - # Full name of the new resource successfully transferred from the source - # hosted by Translation API. Target will be empty if the transfer failed. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # The error result in case of failure. - class TransferResourceResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # A dataset that hosts the examples (sentence pairs) used for translation - # models. - # @!attribute [rw] name - # @return [::String] - # The resource name of the dataset, in form of - # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}` - # @!attribute [rw] display_name - # @return [::String] - # The name of the dataset to show in the interface. The name can be - # up to 32 characters long and can consist only of ASCII Latin letters A-Z - # and a-z, underscores (_), and ASCII digits 0-9. - # @!attribute [rw] source_language_code - # @return [::String] - # The BCP-47 language code of the source language. - # @!attribute [rw] target_language_code - # @return [::String] - # The BCP-47 language code of the target language. - # @!attribute [r] example_count - # @return [::Integer] - # Output only. The number of examples in the dataset. - # @!attribute [r] train_example_count - # @return [::Integer] - # Output only. Number of training examples (sentence pairs). - # @!attribute [r] validate_example_count - # @return [::Integer] - # Output only. Number of validation examples (sentence pairs). - # @!attribute [r] test_example_count - # @return [::Integer] - # Output only. Number of test examples (sentence pairs). - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this dataset was created. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this dataset was last updated. - class Dataset - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for CreateModel. - # @!attribute [rw] parent - # @return [::String] - # Required. The project name, in form of - # `projects/{project}/locations/{location}` - # @!attribute [rw] model - # @return [::Google::Cloud::Translate::V3::Model] - # Required. The Model to create. - class CreateModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata of create model operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class CreateModelMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ListModels. - # @!attribute [rw] parent - # @return [::String] - # Required. Name of the parent project. In form of - # `projects/{project-number-or-id}/locations/{location-id}` - # @!attribute [rw] filter - # @return [::String] - # Optional. An expression for filtering the models that will be returned. - # Supported filter: - # `dataset_id=${dataset_id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server can return fewer results than - # requested. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results for the server to return. - # Typically obtained from next_page_token field in the response of a - # ListModels call. - class ListModelsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for ListModels. - # @!attribute [rw] models - # @return [::Array<::Google::Cloud::Translate::V3::Model>] - # The models read. - # @!attribute [rw] next_page_token - # @return [::String] - # A token to retrieve next page of results. - # Pass this token to the page_token field in the ListModelsRequest to - # obtain the corresponding page. - class ListModelsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for GetModel. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the model to retrieve. - class GetModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for DeleteModel. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the model to delete. - class DeleteModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata of delete model operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::OperationState] - # The current state of the operation. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # The creation time of the operation. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # The last update time of the operation. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # Only populated when operation doesn't succeed. - class DeleteModelMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A trained translation model. - # @!attribute [rw] name - # @return [::String] - # The resource name of the model, in form of - # `projects/{project-number-or-id}/locations/{location_id}/models/{model_id}` - # @!attribute [rw] display_name - # @return [::String] - # The name of the model to show in the interface. The name can be - # up to 32 characters long and can consist only of ASCII Latin letters A-Z - # and a-z, underscores (_), and ASCII digits 0-9. - # @!attribute [rw] dataset - # @return [::String] - # The dataset from which the model is trained, in form of - # `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id}` - # @!attribute [r] source_language_code - # @return [::String] - # Output only. The BCP-47 language code of the source language. - # @!attribute [r] target_language_code - # @return [::String] - # Output only. The BCP-47 language code of the target language. - # @!attribute [r] train_example_count - # @return [::Integer] - # Output only. Number of examples (sentence pairs) used to train the model. - # @!attribute [r] validate_example_count - # @return [::Integer] - # Output only. Number of examples (sentence pairs) used to validate the - # model. - # @!attribute [r] test_example_count - # @return [::Integer] - # Output only. Number of examples (sentence pairs) used to test the model. - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when the model resource was created, which is also - # when the training started. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp when this model was last updated. - class Model - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb deleted file mode 100644 index 2309b07edac1..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/common.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - # The Google Cloud Storage location for the input content. - # @!attribute [rw] input_uri - # @return [::String] - # Required. Source data URI. For example, `gs://my_bucket/my_object`. - class GcsInputSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # An inlined file. - # @!attribute [rw] mime_type - # @return [::String] - # Required. The file's mime type. - # @!attribute [rw] content - # @return [::String] - # Required. The file's byte contents. - # @!attribute [rw] display_name - # @return [::String] - # Required. The file's display name. - class FileInputSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The Google Cloud Storage location for the output content. - # @!attribute [rw] output_uri_prefix - # @return [::String] - # Required. Google Cloud Storage URI to output directory. For example, - # `gs://bucket/directory`. The requesting user must have write permission to - # the bucket. The directory will be created if it doesn't exist. - class GcsOutputDestination - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Represents a single entry in a glossary. - # @!attribute [rw] name - # @return [::String] - # Identifier. The resource name of the entry. - # Format: - # `projects/*/locations/*/glossaries/*/glossaryEntries/*` - # @!attribute [rw] terms_pair - # @return [::Google::Cloud::Translate::V3::GlossaryEntry::GlossaryTermsPair] - # Used for an unidirectional glossary. - # - # Note: The following fields are mutually exclusive: `terms_pair`, `terms_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] terms_set - # @return [::Google::Cloud::Translate::V3::GlossaryEntry::GlossaryTermsSet] - # Used for an equivalent term sets glossary. - # - # Note: The following fields are mutually exclusive: `terms_set`, `terms_pair`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] description - # @return [::String] - # Describes the glossary entry. - class GlossaryEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Represents a single entry for an unidirectional glossary. - # @!attribute [rw] source_term - # @return [::Google::Cloud::Translate::V3::GlossaryTerm] - # The source term is the term that will get match in the text, - # @!attribute [rw] target_term - # @return [::Google::Cloud::Translate::V3::GlossaryTerm] - # The term that will replace the match source term. - class GlossaryTermsPair - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Represents a single entry for an equivalent term set glossary. This is used - # for equivalent term sets where each term can be replaced by the other terms - # in the set. - # @!attribute [rw] terms - # @return [::Array<::Google::Cloud::Translate::V3::GlossaryTerm>] - # Each term in the set represents a term that can be replaced by the other - # terms. - class GlossaryTermsSet - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Represents a single glossary term - # @!attribute [rw] language_code - # @return [::String] - # The language for this glossary term. - # @!attribute [rw] text - # @return [::String] - # The text for the glossary term. - class GlossaryTerm - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Possible states of long running operations. - module OperationState - # Invalid. - OPERATION_STATE_UNSPECIFIED = 0 - - # Request is being processed. - OPERATION_STATE_RUNNING = 1 - - # The operation was successful. - OPERATION_STATE_SUCCEEDED = 2 - - # Failed to process operation. - OPERATION_STATE_FAILED = 3 - - # Request is in the process of being canceled after caller invoked - # longrunning.Operations.CancelOperation on the request id. - OPERATION_STATE_CANCELLING = 4 - - # The operation request was successfully canceled. - OPERATION_STATE_CANCELLED = 5 - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb deleted file mode 100644 index 314073d5ff59..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/cloud/translate/v3/translation_service.rb +++ /dev/null @@ -1,1657 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Translate - module V3 - # Configures transliteration feature on top of translation. - # @!attribute [rw] enable_transliteration - # @return [::Boolean] - # If true, source text in romanized form can be translated to the target - # language. - class TransliterationConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for synchronous translation. - # @!attribute [rw] contents - # @return [::Array<::String>] - # Required. The content of the input in string format. - # We recommend the total content be less than 30,000 codepoints. The max - # length of this field is 1024. Use BatchTranslateText for larger text. - # @!attribute [rw] mime_type - # @return [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @!attribute [rw] source_language_code - # @return [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "en-US" or "sr-Latn". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). If the source - # language isn't specified, the API attempts to identify the source language - # automatically and returns the source language within the response. - # @!attribute [rw] target_language_code - # @return [::String] - # Required. The ISO-639 language code to use for translation of the input - # text, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] parent - # @return [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 same - # location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - # @!attribute [rw] model - # @return [::String] - # 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`, - # - # - Translation LLM models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, - # - # For global (non-regionalized) requests, use `location-id` `global`. - # For example, - # `projects/{project-number-or-id}/locations/global/models/general/nmt`. - # - # If not provided, the default Google model (NMT) will be used - # @!attribute [rw] glossary_config - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - # Optional. Glossary to be applied. The glossary must be - # within the same region (have the same location-id) as the model, otherwise - # an INVALID_ARGUMENT (400) error is returned. - # @!attribute [rw] transliteration_config - # @return [::Google::Cloud::Translate::V3::TransliterationConfig] - # Optional. Transliteration to be applied. - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - class TranslateTextRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # @!attribute [rw] translations - # @return [::Array<::Google::Cloud::Translate::V3::Translation>] - # Text translation responses with no glossary applied. - # This field has the same length as - # {::Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}. - # @!attribute [rw] glossary_translations - # @return [::Array<::Google::Cloud::Translate::V3::Translation>] - # Text translation responses if a glossary is provided in the request. - # This can be the same as - # {::Google::Cloud::Translate::V3::TranslateTextResponse#translations `translations`} - # if no terms apply. This field has the same length as - # {::Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}. - class TranslateTextResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A single translation response. - # @!attribute [rw] translated_text - # @return [::String] - # Text translated into the target language. - # If an error occurs during translation, this field might be excluded from - # the response. - # @!attribute [rw] model - # @return [::String] - # Only present when `model` is present in the request. - # `model` here is normalized to have project number. - # - # For example: - # If the `model` requested in TranslationTextRequest 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`. - # @!attribute [rw] detected_language_code - # @return [::String] - # The ISO-639 language code of source text in the initial request, detected - # automatically, if no source language was passed within the initial - # request. If the source language was passed, auto-detection of the language - # does not occur and this field is empty. - # @!attribute [rw] glossary_config - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - # The `glossary_config` used for this translation. - class Translation - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for synchronous romanization. - # @!attribute [rw] parent - # @return [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # @!attribute [rw] contents - # @return [::Array<::String>] - # Required. The content of the input in string format. - # @!attribute [rw] source_language_code - # @return [::String] - # Optional. The ISO-639 language code of the input text if - # known, for example, "hi" or "zh". Supported language codes are - # listed in [Language - # Support](https://cloud.google.com/translate/docs/languages#roman). If the - # source language isn't specified, the API attempts to identify the source - # language automatically and returns the source language for each content in - # the response. - class RomanizeTextRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A single romanization response. - # @!attribute [rw] romanized_text - # @return [::String] - # Romanized text. - # If an error occurs during romanization, this field might be excluded from - # the response. - # @!attribute [rw] detected_language_code - # @return [::String] - # The ISO-639 language code of source text in the initial request, detected - # automatically, if no source language was passed within the initial - # request. If the source language was passed, auto-detection of the language - # does not occur and this field is empty. - class Romanization - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response message for synchronous romanization. - # @!attribute [rw] romanizations - # @return [::Array<::Google::Cloud::Translate::V3::Romanization>] - # Text romanization responses. - # This field has the same length as - # {::Google::Cloud::Translate::V3::RomanizeTextRequest#contents `contents`}. - class RomanizeTextResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for language detection. - # @!attribute [rw] parent - # @return [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}` or - # `projects/{project-number-or-id}`. - # - # For global calls, use `projects/{project-number-or-id}/locations/global` or - # `projects/{project-number-or-id}`. - # - # Only models within the same region (has same location-id) can be used. - # Otherwise an INVALID_ARGUMENT (400) error is returned. - # @!attribute [rw] model - # @return [::String] - # Optional. The language detection model to be used. - # - # Format: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` - # - # Only one language detection model is currently supported: - # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. - # - # If not specified, the default model is used. - # @!attribute [rw] content - # @return [::String] - # The content of the input stored as a string. - # @!attribute [rw] mime_type - # @return [::String] - # Optional. The format of the source text, for example, "text/html", - # "text/plain". If left blank, the MIME type defaults to "text/html". - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - class DetectLanguageRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The response message for language detection. - # @!attribute [rw] language_code - # @return [::String] - # The ISO-639 language code of the source content in the request, detected - # automatically. - # @!attribute [rw] confidence - # @return [::Float] - # The confidence of the detection result for this language. - class DetectedLanguage - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response message for language detection. - # @!attribute [rw] languages - # @return [::Array<::Google::Cloud::Translate::V3::DetectedLanguage>] - # The most probable language detected by the Translation API. For each - # request, the Translation API will always return only one result. - class DetectLanguageResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for discovering supported languages. - # @!attribute [rw] parent - # @return [::String] - # Required. Project or location to make a call. Must refer to a caller's - # project. - # - # Format: `projects/{project-number-or-id}` or - # `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 AutoML models. - # - # Only models within the same region (have same location-id) can be used, - # otherwise an INVALID_ARGUMENT (400) error is returned. - # @!attribute [rw] display_language_code - # @return [::String] - # Optional. The language to use to return localized, human readable names - # of supported languages. If missing, then display names are not returned - # in a response. - # @!attribute [rw] model - # @return [::String] - # Optional. Get supported languages of this model. - # - # 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`, - # - # - # Returns languages supported by the specified model. - # If missing, we get supported languages of Google general NMT model. - class GetSupportedLanguagesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response message for discovering supported languages. - # @!attribute [rw] languages - # @return [::Array<::Google::Cloud::Translate::V3::SupportedLanguage>] - # A list of supported language responses. This list contains an entry - # for each language the Translation API supports. - class SupportedLanguages - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A single supported language response corresponds to information related - # to one supported language. - # @!attribute [rw] language_code - # @return [::String] - # Supported language code, generally consisting of its ISO 639-1 - # identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes - # including language and region identifiers are returned (for example, - # 'zh-TW' and 'zh-CN'). - # @!attribute [rw] display_name - # @return [::String] - # Human-readable name of the language localized in the display language - # specified in the request. - # @!attribute [rw] support_source - # @return [::Boolean] - # Can be used as a source language. - # @!attribute [rw] support_target - # @return [::Boolean] - # Can be used as a target language. - class SupportedLanguage - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The Google Cloud Storage location for the input content. - # @!attribute [rw] input_uri - # @return [::String] - # Required. Source data URI. For example, `gs://my_bucket/my_object`. - class GcsSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Input configuration for BatchTranslateText request. - # @!attribute [rw] mime_type - # @return [::String] - # Optional. Can be "text/plain" or "text/html". - # For `.tsv`, "text/html" is used if mime_type is missing. - # For `.html`, this field must be "text/html" or empty. - # For `.txt`, this field must be "text/plain" or empty. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Translate::V3::GcsSource] - # Required. Google Cloud Storage location for the source input. - # This can be a single file (for example, - # `gs://translation-test/input.tsv`) or a wildcard (for example, - # `gs://translation-test/*`). If a file extension is `.tsv`, it can - # contain either one or two columns. The first column (optional) is the id - # of the text request. If the first column is missing, we use the row - # number (0-based) from the input file as the ID in the output file. The - # second column is the actual text to be - # translated. We recommend each row be <= 10K Unicode codepoints, - # otherwise an error might be returned. - # Note that the input tsv must be RFC 4180 compliant. - # - # You could use https://github.com/Clever/csvlint to check potential - # formatting errors in your tsv file. - # csvlint --delimiter='\t' your_input_file.tsv - # - # The other supported file extensions are `.txt` or `.html`, which is - # treated as a single large chunk of text. - class InputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The Google Cloud Storage location for the output content. - # @!attribute [rw] output_uri_prefix - # @return [::String] - # 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. - class GcsDestination - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Output configuration for BatchTranslateText request. - # @!attribute [rw] gcs_destination - # @return [::Google::Cloud::Translate::V3::GcsDestination] - # Google Cloud Storage destination for output content. - # For every single input file (for example, gs://a/b/c.[extension]), we - # generate at most 2 * n output files. (n is the # of target_language_codes - # in the BatchTranslateTextRequest). - # - # Output files (tsv) generated are compliant with RFC 4180 except that - # record delimiters are '\n' instead of '\r\n'. We don't provide any way to - # change record delimiters. - # - # While the input files are being processed, we write/update an index file - # 'index.csv' under 'output_uri_prefix' (for example, - # gs://translation-test/index.csv) The index file is generated/updated as - # new files are being translated. The format is: - # - # input_file,target_language_code,translations_file,errors_file, - # glossary_translations_file,glossary_errors_file - # - # input_file is one file we matched using gcs_source.input_uri. - # target_language_code is provided in the request. - # translations_file contains the translations. (details provided below) - # errors_file contains the errors during processing of the file. (details - # below). Both translations_file and errors_file could be empty - # strings if we have no content to output. - # glossary_translations_file and glossary_errors_file are always empty - # strings if the input_file is tsv. 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#retention-policy) - # - # The format of translations_file (for target language code 'trg') is: - # `gs://translation_test/a_b_c_'trg'_translations.[extension]` - # - # If the input file extension is tsv, the output has the following - # columns: - # Column 1: ID of the request provided in the input, if it's not - # provided in the input, then the input row number is used (0-based). - # Column 2: source sentence. - # Column 3: translation without applying a glossary. Empty string if there - # is an error. - # Column 4 (only present if a glossary is provided in the request): - # translation after applying the glossary. Empty string if there is an - # error applying the glossary. Could be same string as column 3 if there is - # no glossary applied. - # - # 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]` - # - # The format of errors file (for target language code 'trg') is: - # `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 - # provided in the input, then the input row number is used (0-based). - # Column 2: source sentence. - # Column 3: Error detail for the translation. Could be empty. - # Column 4 (only present if a glossary is provided in the request): - # Error when applying the glossary. - # - # 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]` - class OutputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A document translation request input config. - # @!attribute [rw] content - # @return [::String] - # Document's content represented as a stream of bytes. - # - # Note: The following fields are mutually exclusive: `content`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Translate::V3::GcsSource] - # Google Cloud Storage location. This must be a single file. - # For example: gs://example_bucket/example_file.pdf - # - # Note: The following fields are mutually exclusive: `gcs_source`, `content`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] mime_type - # @return [::String] - # 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 - class DocumentInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A document translation request output config. - # @!attribute [rw] gcs_destination - # @return [::Google::Cloud::Translate::V3::GcsDestination] - # 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. - # @!attribute [rw] mime_type - # @return [::String] - # 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 - class DocumentOutputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A document translation request. - # @!attribute [rw] parent - # @return [::String] - # 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. - # @!attribute [rw] source_language_code - # @return [::String] - # Optional. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). 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. - # @!attribute [rw] target_language_code - # @return [::String] - # Required. The ISO-639 language code to use for translation of the input - # document, set to one of the language codes listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] document_input_config - # @return [::Google::Cloud::Translate::V3::DocumentInputConfig] - # Required. Input configurations. - # @!attribute [rw] document_output_config - # @return [::Google::Cloud::Translate::V3::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. - # @!attribute [rw] model - # @return [::String] - # 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. - # @!attribute [rw] glossary_config - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - # Optional. Glossary to be applied. The glossary must be within the same - # region (have the same location-id) as the model, otherwise an - # INVALID_ARGUMENT (400) error is returned. - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters (Unicode - # codepoints), can only contain lowercase letters, numeric characters, - # underscores and dashes. International characters are allowed. Label values - # are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - # @!attribute [rw] customized_attribution - # @return [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @!attribute [rw] is_translate_native_pdf_only - # @return [::Boolean] - # Optional. is_translate_native_pdf_only field for external customers. - # If true, the page limit of online native pdf translation is 300 and only - # native pdf pages will be translated. - # @!attribute [rw] enable_shadow_removal_native_pdf - # @return [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @!attribute [rw] enable_rotation_correction - # @return [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - class TranslateDocumentRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # A translated document message. - # @!attribute [rw] byte_stream_outputs - # @return [::Array<::String>] - # 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. - # @!attribute [rw] mime_type - # @return [::String] - # The translated document's mime type. - # @!attribute [rw] detected_language_code - # @return [::String] - # 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. - class DocumentTranslation - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A translated document response message. - # @!attribute [rw] document_translation - # @return [::Google::Cloud::Translate::V3::DocumentTranslation] - # Translated document. - # @!attribute [rw] glossary_document_translation - # @return [::Google::Cloud::Translate::V3::DocumentTranslation] - # 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. - # @!attribute [rw] model - # @return [::String] - # 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`. - # @!attribute [rw] glossary_config - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - # The `glossary_config` used for this translation. - class TranslateDocumentResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The batch translation request. - # @!attribute [rw] parent - # @return [::String] - # Required. Location to make a call. Must refer to a caller's project. - # - # Format: `projects/{project-number-or-id}/locations/{location-id}`. - # - # The `global` location is not supported for batch translation. - # - # Only AutoML Translation models or glossaries within the same region (have - # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - # error is returned. - # @!attribute [rw] source_language_code - # @return [::String] - # Required. Source language code. Supported language codes are listed in - # [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] target_language_codes - # @return [::Array<::String>] - # Required. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] models - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The models to use for translation. Map's key is target language - # code. Map's value is model name. Value can be a built-in general model, - # or an AutoML Translation model. - # - # The value format depends on model type: - # - # - AutoML Translation models: - # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - # - # - General (built-in) models: - # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - # - # - # If the map is empty or a specific model is - # not requested for a language pair, then default google model (nmt) is used. - # @!attribute [rw] input_configs - # @return [::Array<::Google::Cloud::Translate::V3::InputConfig>] - # Required. Input configurations. - # The total number of files matched should be <= 100. - # The total content size should be <= 100M Unicode codepoints. - # The files must use UTF-8 encoding. - # @!attribute [rw] output_config - # @return [::Google::Cloud::Translate::V3::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. - # @!attribute [rw] glossaries - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}] - # Optional. Glossaries to be applied for translation. - # It's keyed by target language code. - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The labels with user-defined metadata for the request. - # - # Label keys and values can be no longer than 63 characters - # (Unicode codepoints), can only contain lowercase letters, numeric - # characters, underscores and dashes. International characters are allowed. - # Label values are optional. Label keys must start with a letter. - # - # See https://cloud.google.com/translate/docs/advanced/labels for more - # information. - class BatchTranslateTextRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class ModelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - class GlossariesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # State metadata for the batch translation operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::BatchTranslateMetadata::State] - # The state of the operation. - # @!attribute [rw] translated_characters - # @return [::Integer] - # Number of successfully translated characters so far (Unicode codepoints). - # @!attribute [rw] failed_characters - # @return [::Integer] - # Number of characters that have failed to process so far (Unicode - # codepoints). - # @!attribute [rw] total_characters - # @return [::Integer] - # Total number of characters (Unicode codepoints). - # This is the total number of codepoints from input files times the number of - # target languages and appears here shortly after the call is submitted. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # Time when the operation was submitted. - class BatchTranslateMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # State of the job. - module 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 - end - end - - # Stored in the - # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} - # field returned by BatchTranslateText if at least one sentence is translated - # successfully. - # @!attribute [rw] total_characters - # @return [::Integer] - # Total number of characters (Unicode codepoints). - # @!attribute [rw] translated_characters - # @return [::Integer] - # Number of successfully translated characters (Unicode codepoints). - # @!attribute [rw] failed_characters - # @return [::Integer] - # Number of characters that have failed to process (Unicode codepoints). - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # Time when the operation was submitted. - # @!attribute [rw] end_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation is finished and - # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is - # set to true. - class BatchTranslateResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Input configuration for glossaries. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Translate::V3::GcsSource] - # Required. Google Cloud Storage location of glossary data. - # File format is determined based on the filename extension. API returns - # [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - # formats. Wildcards are not allowed. This must be a single file in one of - # the following formats: - # - # For unidirectional glossaries: - # - # - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. - # The first column is source text. The second column is target text. - # No headers in this file. The first row contains data and not column - # names. - # - # - TMX (`.tmx`): TMX file with parallel data defining source/target term - # pairs. - # - # For equivalent term sets glossaries: - # - # - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - # in multiple languages. See documentation for more information - - # [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). - class GlossaryInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Represents a glossary built from user-provided data. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the glossary. Glossary names have the form - # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. - # @!attribute [rw] language_pair - # @return [::Google::Cloud::Translate::V3::Glossary::LanguageCodePair] - # Used with unidirectional glossaries. - # - # Note: The following fields are mutually exclusive: `language_pair`, `language_codes_set`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] language_codes_set - # @return [::Google::Cloud::Translate::V3::Glossary::LanguageCodesSet] - # Used with equivalent term set glossaries. - # - # Note: The following fields are mutually exclusive: `language_codes_set`, `language_pair`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] input_config - # @return [::Google::Cloud::Translate::V3::GlossaryInputConfig] - # Required. Provides examples to build the glossary from. - # Total glossary must not exceed 10M Unicode codepoints. - # @!attribute [r] entry_count - # @return [::Integer] - # Output only. The number of entries defined in the glossary. - # @!attribute [r] submit_time - # @return [::Google::Protobuf::Timestamp] - # Output only. When CreateGlossary was called. - # @!attribute [r] end_time - # @return [::Google::Protobuf::Timestamp] - # Output only. When the glossary creation was finished. - # @!attribute [rw] display_name - # @return [::String] - # Optional. The display name of the glossary. - class Glossary - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Used with unidirectional glossaries. - # @!attribute [rw] source_language_code - # @return [::String] - # Required. The ISO-639 language code of the input text, for example, - # "en-US". Expected to be an exact match for GlossaryTerm.language_code. - # @!attribute [rw] target_language_code - # @return [::String] - # Required. The ISO-639 language code for translation output, for example, - # "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - class LanguageCodePair - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Used with equivalent term set glossaries. - # @!attribute [rw] language_codes - # @return [::Array<::String>] - # The ISO-639 language code(s) for terms defined in the glossary. - # All entries are unique. The list contains at least two entries. - # Expected to be an exact match for GlossaryTerm.language_code. - class LanguageCodesSet - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Request message for CreateGlossary. - # @!attribute [rw] parent - # @return [::String] - # Required. The project name. - # @!attribute [rw] glossary - # @return [::Google::Cloud::Translate::V3::Glossary] - # Required. The glossary to create. - class CreateGlossaryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for the update glossary flow - # @!attribute [rw] glossary - # @return [::Google::Cloud::Translate::V3::Glossary] - # Required. The glossary entry to update. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # The list of fields to be updated. Currently only `display_name` and - # 'input_config' - class UpdateGlossaryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for GetGlossary. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the glossary to retrieve. - class GetGlossaryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for DeleteGlossary. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the glossary to delete. - class DeleteGlossaryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ListGlossaries. - # @!attribute [rw] parent - # @return [::String] - # Required. The name of the project from which to list all of the glossaries. - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server may return fewer glossaries than - # requested. If unspecified, the server picks an appropriate default. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of [ListGlossariesResponse.next_page_token] - # returned from the previous call to `ListGlossaries` method. - # The first page is returned if `page_token`is empty or missing. - # @!attribute [rw] filter - # @return [::String] - # Optional. Filter specifying constraints of a list operation. - # 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. - class ListGlossariesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for ListGlossaries. - # @!attribute [rw] glossaries - # @return [::Array<::Google::Cloud::Translate::V3::Glossary>] - # The list of glossaries for a project. - # @!attribute [rw] next_page_token - # @return [::String] - # A token to retrieve a page of results. Pass this value in the - # [ListGlossariesRequest.page_token] field in the subsequent call to - # `ListGlossaries` method to retrieve the next page of results. - class ListGlossariesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for the Get Glossary Entry Api - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the glossary entry to get - class GetGlossaryEntryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for Delete Glossary Entry - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the glossary entry to delete - class DeleteGlossaryEntryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ListGlossaryEntries - # @!attribute [rw] parent - # @return [::String] - # Required. The parent glossary resource name for listing the glossary's - # entries. - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Requested page size. The server may return fewer glossary entries - # than requested. If unspecified, the server picks an appropriate default. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A token identifying a page of results the server should return. - # Typically, this is the value of - # [ListGlossaryEntriesResponse.next_page_token] returned from the previous - # call. The first page is returned if `page_token`is empty or missing. - class ListGlossaryEntriesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for ListGlossaryEntries - # @!attribute [rw] glossary_entries - # @return [::Array<::Google::Cloud::Translate::V3::GlossaryEntry>] - # Optional. The Glossary Entries - # @!attribute [rw] next_page_token - # @return [::String] - # Optional. A token to retrieve a page of results. Pass this value in the - # [ListGLossaryEntriesRequest.page_token] field in the subsequent calls. - class ListGlossaryEntriesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for CreateGlossaryEntry - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the glossary to create the entry under. - # @!attribute [rw] glossary_entry - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # Required. The glossary entry to create - class CreateGlossaryEntryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for UpdateGlossaryEntry - # @!attribute [rw] glossary_entry - # @return [::Google::Cloud::Translate::V3::GlossaryEntry] - # Required. The glossary entry to update. - class UpdateGlossaryEntryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Stored in the - # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} - # field returned by CreateGlossary. - # @!attribute [rw] name - # @return [::String] - # The name of the glossary that is being created. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::CreateGlossaryMetadata::State] - # The current state of the glossary creation operation. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation was submitted to the server. - class CreateGlossaryMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enumerates the possible states that the creation request can be in. - module State - # Invalid. - STATE_UNSPECIFIED = 0 - - # Request is being processed. - RUNNING = 1 - - # The glossary was successfully created. - SUCCEEDED = 2 - - # Failed to create the glossary. - FAILED = 3 - - # Request is in the process of being canceled after caller invoked - # longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4 - - # The glossary creation request was successfully canceled. - CANCELLED = 5 - end - end - - # Stored in the - # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} - # field returned by UpdateGlossary. - # @!attribute [rw] glossary - # @return [::Google::Cloud::Translate::V3::Glossary] - # The updated glossary object. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::UpdateGlossaryMetadata::State] - # The current state of the glossary update operation. If the glossary input - # file was not updated this will be completed immediately - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation was submitted to the server. - class UpdateGlossaryMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enumerates the possible states that the update request can be in. - module State - # Invalid. - STATE_UNSPECIFIED = 0 - - # Request is being processed. - RUNNING = 1 - - # The glossary was successfully updated. - SUCCEEDED = 2 - - # Failed to update the glossary. - FAILED = 3 - - # Request is in the process of being canceled after caller invoked - # longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4 - - # The glossary update request was successfully canceled. - CANCELLED = 5 - end - end - - # Stored in the - # {::Google::Longrunning::Operation#metadata google.longrunning.Operation.metadata} - # field returned by DeleteGlossary. - # @!attribute [rw] name - # @return [::String] - # The name of the glossary that is being deleted. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::DeleteGlossaryMetadata::State] - # The current state of the glossary deletion operation. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation was submitted to the server. - class DeleteGlossaryMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enumerates the possible states that the creation request can be in. - module State - # Invalid. - STATE_UNSPECIFIED = 0 - - # Request is being processed. - RUNNING = 1 - - # The glossary was successfully deleted. - SUCCEEDED = 2 - - # Failed to delete the glossary. - FAILED = 3 - - # Request is in the process of being canceled after caller invoked - # longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4 - - # The glossary deletion request was successfully canceled. - CANCELLED = 5 - end - end - - # Stored in the - # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} - # field returned by DeleteGlossary. - # @!attribute [rw] name - # @return [::String] - # The name of the deleted glossary. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation was submitted to the server. - # @!attribute [rw] end_time - # @return [::Google::Protobuf::Timestamp] - # The time when the glossary deletion is finished and - # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is - # set to true. - class DeleteGlossaryResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The BatchTranslateDocument request. - # @!attribute [rw] parent - # @return [::String] - # 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. - # @!attribute [rw] source_language_code - # @return [::String] - # Required. The ISO-639 language code of the input document if known, for - # example, "en-US" or "sr-Latn". Supported language codes are listed in - # [Language Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] target_language_codes - # @return [::Array<::String>] - # Required. The ISO-639 language code to use for translation of the input - # document. Specify up to 10 language codes here. Supported language codes - # are listed in [Language - # Support](https://cloud.google.com/translate/docs/languages). - # @!attribute [rw] input_configs - # @return [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig>] - # 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. - # @!attribute [rw] output_config - # @return [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig] - # 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. - # @!attribute [rw] models - # @return [::Google::Protobuf::Map{::String => ::String}] - # 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. - # @!attribute [rw] glossaries - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}] - # Optional. Glossaries to be applied. It's keyed by target language code. - # @!attribute [rw] format_conversions - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The file format conversion map that is applied to all input - # files. The map key is the original mime_type. The map 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. - # @!attribute [rw] customized_attribution - # @return [::String] - # Optional. This flag is to support user customized attribution. - # If not provided, the default is `Machine Translated by Google`. - # Customized attribution should follow rules in - # https://cloud.google.com/translate/attribution#attribution_and_logos - # @!attribute [rw] enable_shadow_removal_native_pdf - # @return [::Boolean] - # Optional. If true, use the text removal server to remove the shadow text on - # background image for native pdf translation. - # Shadow removal feature can only be enabled when - # is_translate_native_pdf_only: false && pdf_native_only: false - # @!attribute [rw] enable_rotation_correction - # @return [::Boolean] - # Optional. If true, enable auto rotation correction in DVS. - class BatchTranslateDocumentRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class ModelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig] - class GlossariesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class FormatConversionsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Input configuration for BatchTranslateDocument request. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Translate::V3::GcsSource] - # 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. - class BatchDocumentInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Output configuration for BatchTranslateDocument request. - # @!attribute [rw] gcs_destination - # @return [::Google::Cloud::Translate::V3::GcsDestination] - # 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#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. - class BatchDocumentOutputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Stored in the - # {::Google::Longrunning::Operation#response google.longrunning.Operation.response} - # field returned by BatchTranslateDocument if at least one document is - # translated successfully. - # @!attribute [rw] total_pages - # @return [::Integer] - # Total number of pages to translate in all documents. Documents without - # clear page definition (such as XLSX) are not counted. - # @!attribute [rw] translated_pages - # @return [::Integer] - # Number of successfully translated pages in all documents. Documents without - # clear page definition (such as XLSX) are not counted. - # @!attribute [rw] failed_pages - # @return [::Integer] - # Number of pages that failed to process in all documents. Documents without - # clear page definition (such as XLSX) are not counted. - # @!attribute [rw] total_billable_pages - # @return [::Integer] - # Number of billable pages in documents with clear page definition (such as - # PDF, DOCX, PPTX) - # @!attribute [rw] total_characters - # @return [::Integer] - # Total number of characters (Unicode codepoints) in all documents. - # @!attribute [rw] translated_characters - # @return [::Integer] - # Number of successfully translated characters (Unicode codepoints) in all - # documents. - # @!attribute [rw] failed_characters - # @return [::Integer] - # Number of characters that have failed to process (Unicode codepoints) in - # all documents. - # @!attribute [rw] total_billable_characters - # @return [::Integer] - # Number of billable characters (Unicode codepoints) in documents without - # clear page definition, such as XLSX. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # Time when the operation was submitted. - # @!attribute [rw] end_time - # @return [::Google::Protobuf::Timestamp] - # The time when the operation is finished and - # {::Google::Longrunning::Operation#done google.longrunning.Operation.done} is - # set to true. - class BatchTranslateDocumentResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # State metadata for the batch translation operation. - # @!attribute [rw] state - # @return [::Google::Cloud::Translate::V3::BatchTranslateDocumentMetadata::State] - # The state of the operation. - # @!attribute [rw] total_pages - # @return [::Integer] - # Total number of pages to translate in all documents so far. Documents - # without clear page definition (such as XLSX) are not counted. - # @!attribute [rw] translated_pages - # @return [::Integer] - # Number of successfully translated pages in all documents so far. Documents - # without clear page definition (such as XLSX) are not counted. - # @!attribute [rw] failed_pages - # @return [::Integer] - # Number of pages that failed to process in all documents so far. Documents - # without clear page definition (such as XLSX) are not counted. - # @!attribute [rw] total_billable_pages - # @return [::Integer] - # Number of billable pages in documents with clear page definition (such as - # PDF, DOCX, PPTX) so far. - # @!attribute [rw] total_characters - # @return [::Integer] - # Total number of characters (Unicode codepoints) in all documents so far. - # @!attribute [rw] translated_characters - # @return [::Integer] - # Number of successfully translated characters (Unicode codepoints) in all - # documents so far. - # @!attribute [rw] failed_characters - # @return [::Integer] - # Number of characters that have failed to process (Unicode codepoints) in - # all documents so far. - # @!attribute [rw] total_billable_characters - # @return [::Integer] - # Number of billable characters (Unicode codepoints) in documents without - # clear page definition (such as XLSX) so far. - # @!attribute [rw] submit_time - # @return [::Google::Protobuf::Timestamp] - # Time when the operation was submitted. - class BatchTranslateDocumentMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # State of the job. - module 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 - end - end - - # Configures which glossary is used for a specific target language and defines - # options for applying that glossary. - # @!attribute [rw] glossary - # @return [::String] - # Required. The `glossary` to be applied for this translation. - # - # The format depends on the glossary: - # - # - User-provided custom glossary: - # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` - # @!attribute [rw] ignore_case - # @return [::Boolean] - # Optional. Indicates match is case insensitive. The default value is `false` - # if missing. - # @!attribute [rw] contextual_translation_enabled - # @return [::Boolean] - # Optional. If set to true, the glossary will be used for contextual - # translation. - class TranslateTextGlossaryConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb deleted file mode 100644 index 7a757f512165..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/longrunning/operations.rb +++ /dev/null @@ -1,191 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Longrunning - # This resource represents a long-running operation that is the result of a - # network API call. - # @!attribute [rw] name - # @return [::String] - # The server-assigned name, which is only unique within the same service that - # originally returns it. If you use the default HTTP mapping, the - # `name` should be a resource name ending with `operations/{unique_id}`. - # @!attribute [rw] metadata - # @return [::Google::Protobuf::Any] - # Service-specific metadata associated with the operation. It typically - # contains progress information and common metadata such as create time. - # Some services might not provide such metadata. Any method that returns a - # long-running operation should document the metadata type, if any. - # @!attribute [rw] done - # @return [::Boolean] - # If the value is `false`, it means the operation is still in progress. - # If `true`, the operation is completed, and either `error` or `response` is - # available. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # The error result of the operation in case of failure or cancellation. - # - # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] response - # @return [::Google::Protobuf::Any] - # The normal, successful response of the operation. If the original - # method returns no data on success, such as `Delete`, the response is - # `google.protobuf.Empty`. If the original method is standard - # `Get`/`Create`/`Update`, the response should be the resource. For other - # methods, the response should have the type `XxxResponse`, where `Xxx` - # is the original method name. For example, if the original method name - # is `TakeSnapshot()`, the inferred response type is - # `TakeSnapshotResponse`. - # - # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class Operation - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.GetOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource. - class GetOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.ListOperations. - # @!attribute [rw] name - # @return [::String] - # The name of the operation's parent resource. - # @!attribute [rw] filter - # @return [::String] - # The standard list filter. - # @!attribute [rw] page_size - # @return [::Integer] - # The standard list page size. - # @!attribute [rw] page_token - # @return [::String] - # The standard list page token. - # @!attribute [rw] return_partial_success - # @return [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - class ListOperationsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response message for - # Operations.ListOperations. - # @!attribute [rw] operations - # @return [::Array<::Google::Longrunning::Operation>] - # A list of operations that matches the specified filter in the request. - # @!attribute [rw] next_page_token - # @return [::String] - # The standard List next-page token. - # @!attribute [rw] unreachable - # @return [::Array<::String>] - # Unordered list. Unreachable resources. Populated when the request sets - # `ListOperationsRequest.return_partial_success` and reads across - # collections e.g. when attempting to list all resources across all supported - # locations. - class ListOperationsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.CancelOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to be cancelled. - class CancelOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.DeleteOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to be deleted. - class DeleteOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.WaitOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to wait on. - # @!attribute [rw] timeout - # @return [::Google::Protobuf::Duration] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - class WaitOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A message representing the message types used by a long-running operation. - # - # Example: - # - # rpc Export(ExportRequest) returns (google.longrunning.Operation) { - # option (google.longrunning.operation_info) = { - # response_type: "ExportResponse" - # metadata_type: "ExportMetadata" - # }; - # } - # @!attribute [rw] response_type - # @return [::String] - # Required. The message name of the primary return type for this - # long-running operation. - # This type will be used to deserialize the LRO's response. - # - # If the response is in a different package from the rpc, a fully-qualified - # message name must be used (e.g. `google.protobuf.Struct`). - # - # Note: Altering this value constitutes a breaking change. - # @!attribute [rw] metadata_type - # @return [::String] - # Required. The message name of the metadata type for this long-running - # operation. - # - # If the response is in a different package from the rpc, a fully-qualified - # message name must be used (e.g. `google.protobuf.Struct`). - # - # Note: Altering this value constitutes a breaking change. - class OperationInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb deleted file mode 100644 index 58691995f02e..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/any.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # `Any` contains an arbitrary serialized protocol buffer message along with a - # URL that describes the type of the serialized message. - # - # Protobuf library provides support to pack/unpack Any values in the form - # of utility functions or additional generated methods of the Any type. - # - # Example 1: Pack and unpack a message in C++. - # - # Foo foo = ...; - # Any any; - # any.PackFrom(foo); - # ... - # if (any.UnpackTo(&foo)) { - # ... - # } - # - # Example 2: Pack and unpack a message in Java. - # - # Foo foo = ...; - # Any any = Any.pack(foo); - # ... - # if (any.is(Foo.class)) { - # foo = any.unpack(Foo.class); - # } - # // or ... - # if (any.isSameTypeAs(Foo.getDefaultInstance())) { - # foo = any.unpack(Foo.getDefaultInstance()); - # } - # - # Example 3: Pack and unpack a message in Python. - # - # foo = Foo(...) - # any = Any() - # any.Pack(foo) - # ... - # if any.Is(Foo.DESCRIPTOR): - # any.Unpack(foo) - # ... - # - # Example 4: Pack and unpack a message in Go - # - # foo := &pb.Foo{...} - # any, err := anypb.New(foo) - # if err != nil { - # ... - # } - # ... - # foo := &pb.Foo{} - # if err := any.UnmarshalTo(foo); err != nil { - # ... - # } - # - # The pack methods provided by protobuf library will by default use - # 'type.googleapis.com/full.type.name' as the type URL and the unpack - # methods only use the fully qualified type name after the last '/' - # in the type URL, for example "foo.bar.com/x/y.z" will yield type - # name "y.z". - # - # JSON - # ==== - # The JSON representation of an `Any` value uses the regular - # representation of the deserialized, embedded message, with an - # additional field `@type` which contains the type URL. Example: - # - # package google.profile; - # message Person { - # string first_name = 1; - # string last_name = 2; - # } - # - # { - # "@type": "type.googleapis.com/google.profile.Person", - # "firstName": , - # "lastName": - # } - # - # If the embedded message type is well-known and has a custom JSON - # representation, that representation will be embedded adding a field - # `value` which holds the custom JSON in addition to the `@type` - # field. Example (for message [google.protobuf.Duration][]): - # - # { - # "@type": "type.googleapis.com/google.protobuf.Duration", - # "value": "1.212s" - # } - # @!attribute [rw] type_url - # @return [::String] - # A URL/resource name that uniquely identifies the type of the serialized - # protocol buffer message. This string must contain at least - # one "/" character. The last segment of the URL's path must represent - # the fully qualified name of the type (as in - # `path/google.protobuf.Duration`). The name should be in a canonical form - # (e.g., leading "." is not accepted). - # - # In practice, teams usually precompile into the binary all types that they - # expect it to use in the context of Any. However, for URLs which use the - # scheme `http`, `https`, or no scheme, one can optionally set up a type - # server that maps type URLs to message definitions as follows: - # - # * If no scheme is provided, `https` is assumed. - # * An HTTP GET on the URL must yield a [google.protobuf.Type][] - # value in binary format, or produce an error. - # * Applications are allowed to cache lookup results based on the - # URL, or have them precompiled into a binary to avoid any - # lookup. Therefore, binary compatibility needs to be preserved - # on changes to types. (Use versioned type names to manage - # breaking changes.) - # - # Note: this functionality is not currently available in the official - # protobuf release, and it is not used for type URLs beginning with - # type.googleapis.com. As of May 2023, there are no widely used type server - # implementations and no plans to implement one. - # - # Schemes other than `http`, `https` (or the empty scheme) might be - # used with implementation specific semantics. - # @!attribute [rw] value - # @return [::String] - # Must be a valid serialized protocol buffer of the above specified type. - class Any - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb deleted file mode 100644 index ea59f1f91daf..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/duration.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A Duration represents a signed, fixed-length span of time represented - # as a count of seconds and fractions of seconds at nanosecond - # resolution. It is independent of any calendar and concepts like "day" - # or "month". It is related to Timestamp in that the difference between - # two Timestamp values is a Duration and it can be added or subtracted - # from a Timestamp. Range is approximately +-10,000 years. - # - # # Examples - # - # Example 1: Compute Duration from two Timestamps in pseudo code. - # - # Timestamp start = ...; - # Timestamp end = ...; - # Duration duration = ...; - # - # duration.seconds = end.seconds - start.seconds; - # duration.nanos = end.nanos - start.nanos; - # - # if (duration.seconds < 0 && duration.nanos > 0) { - # duration.seconds += 1; - # duration.nanos -= 1000000000; - # } else if (duration.seconds > 0 && duration.nanos < 0) { - # duration.seconds -= 1; - # duration.nanos += 1000000000; - # } - # - # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - # - # Timestamp start = ...; - # Duration duration = ...; - # Timestamp end = ...; - # - # end.seconds = start.seconds + duration.seconds; - # end.nanos = start.nanos + duration.nanos; - # - # if (end.nanos < 0) { - # end.seconds -= 1; - # end.nanos += 1000000000; - # } else if (end.nanos >= 1000000000) { - # end.seconds += 1; - # end.nanos -= 1000000000; - # } - # - # Example 3: Compute Duration from datetime.timedelta in Python. - # - # td = datetime.timedelta(days=3, minutes=10) - # duration = Duration() - # duration.FromTimedelta(td) - # - # # JSON Mapping - # - # In JSON format, the Duration type is encoded as a string rather than an - # object, where the string ends in the suffix "s" (indicating seconds) and - # is preceded by the number of seconds, with nanoseconds expressed as - # fractional seconds. For example, 3 seconds with 0 nanoseconds should be - # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should - # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 - # microsecond should be expressed in JSON format as "3.000001s". - # @!attribute [rw] seconds - # @return [::Integer] - # Signed seconds of the span of time. Must be from -315,576,000,000 - # to +315,576,000,000 inclusive. Note: these bounds are computed from: - # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - # @!attribute [rw] nanos - # @return [::Integer] - # Signed fractions of a second at nanosecond resolution of the span - # of time. Durations less than one second are represented with a 0 - # `seconds` field and a positive or negative `nanos` field. For durations - # of one second or more, a non-zero value for the `nanos` field must be - # of the same sign as the `seconds` field. Must be from -999,999,999 - # to +999,999,999 inclusive. - class Duration - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb deleted file mode 100644 index 83e4481834a6..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/empty.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A generic empty message that you can re-use to avoid defining duplicated - # empty messages in your APIs. A typical example is to use it as the request - # or the response type of an API method. For instance: - # - # service Foo { - # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - # } - class Empty - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb deleted file mode 100644 index 7f3ffc78601a..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/field_mask.rb +++ /dev/null @@ -1,229 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # `FieldMask` represents a set of symbolic field paths, for example: - # - # paths: "f.a" - # paths: "f.b.d" - # - # Here `f` represents a field in some root message, `a` and `b` - # fields in the message found in `f`, and `d` a field found in the - # message in `f.b`. - # - # Field masks are used to specify a subset of fields that should be - # returned by a get operation or modified by an update operation. - # Field masks also have a custom JSON encoding (see below). - # - # # Field Masks in Projections - # - # When used in the context of a projection, a response message or - # sub-message is filtered by the API to only contain those fields as - # specified in the mask. For example, if the mask in the previous - # example is applied to a response message as follows: - # - # f { - # a : 22 - # b { - # d : 1 - # x : 2 - # } - # y : 13 - # } - # z: 8 - # - # The result will not contain specific values for fields x,y and z - # (their value will be set to the default, and omitted in proto text - # output): - # - # - # f { - # a : 22 - # b { - # d : 1 - # } - # } - # - # A repeated field is not allowed except at the last position of a - # paths string. - # - # If a FieldMask object is not present in a get operation, the - # operation applies to all fields (as if a FieldMask of all fields - # had been specified). - # - # Note that a field mask does not necessarily apply to the - # top-level response message. In case of a REST get operation, the - # field mask applies directly to the response, but in case of a REST - # list operation, the mask instead applies to each individual message - # in the returned resource list. In case of a REST custom method, - # other definitions may be used. Where the mask applies will be - # clearly documented together with its declaration in the API. In - # any case, the effect on the returned resource/resources is required - # behavior for APIs. - # - # # Field Masks in Update Operations - # - # A field mask in update operations specifies which fields of the - # targeted resource are going to be updated. The API is required - # to only change the values of the fields as specified in the mask - # and leave the others untouched. If a resource is passed in to - # describe the updated values, the API ignores the values of all - # fields not covered by the mask. - # - # If a repeated field is specified for an update operation, new values will - # be appended to the existing repeated field in the target resource. Note that - # a repeated field is only allowed in the last position of a `paths` string. - # - # If a sub-message is specified in the last position of the field mask for an - # update operation, then new value will be merged into the existing sub-message - # in the target resource. - # - # For example, given the target message: - # - # f { - # b { - # d: 1 - # x: 2 - # } - # c: [1] - # } - # - # And an update message: - # - # f { - # b { - # d: 10 - # } - # c: [2] - # } - # - # then if the field mask is: - # - # paths: ["f.b", "f.c"] - # - # then the result will be: - # - # f { - # b { - # d: 10 - # x: 2 - # } - # c: [1, 2] - # } - # - # An implementation may provide options to override this default behavior for - # repeated and message fields. - # - # In order to reset a field's value to the default, the field must - # be in the mask and set to the default value in the provided resource. - # Hence, in order to reset all fields of a resource, provide a default - # instance of the resource and set all fields in the mask, or do - # not provide a mask as described below. - # - # If a field mask is not present on update, the operation applies to - # all fields (as if a field mask of all fields has been specified). - # Note that in the presence of schema evolution, this may mean that - # fields the client does not know and has therefore not filled into - # the request will be reset to their default. If this is unwanted - # behavior, a specific service may require a client to always specify - # a field mask, producing an error if not. - # - # As with get operations, the location of the resource which - # describes the updated values in the request message depends on the - # operation kind. In any case, the effect of the field mask is - # required to be honored by the API. - # - # ## Considerations for HTTP REST - # - # The HTTP kind of an update operation which uses a field mask must - # be set to PATCH instead of PUT in order to satisfy HTTP semantics - # (PUT must only be used for full updates). - # - # # JSON Encoding of Field Masks - # - # In JSON, a field mask is encoded as a single string where paths are - # separated by a comma. Fields name in each path are converted - # to/from lower-camel naming conventions. - # - # As an example, consider the following message declarations: - # - # message Profile { - # User user = 1; - # Photo photo = 2; - # } - # message User { - # string display_name = 1; - # string address = 2; - # } - # - # In proto a field mask for `Profile` may look as such: - # - # mask { - # paths: "user.display_name" - # paths: "photo" - # } - # - # In JSON, the same mask is represented as below: - # - # { - # mask: "user.displayName,photo" - # } - # - # # Field Masks and Oneof Fields - # - # Field masks treat fields in oneofs just as regular fields. Consider the - # following message: - # - # message SampleMessage { - # oneof test_oneof { - # string name = 4; - # SubMessage sub_message = 9; - # } - # } - # - # The field mask can be: - # - # mask { - # paths: "name" - # } - # - # Or: - # - # mask { - # paths: "sub_message" - # } - # - # Note that oneof type names ("test_oneof" in this case) cannot be used in - # paths. - # - # ## Field Mask Verification - # - # The implementation of any API method which has a FieldMask type field in the - # request should verify the included field paths, and return an - # `INVALID_ARGUMENT` error if any path is unmappable. - # @!attribute [rw] paths - # @return [::Array<::String>] - # The set of field mask paths. - class FieldMask - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb deleted file mode 100644 index 74352be9c58c..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/protobuf/timestamp.rb +++ /dev/null @@ -1,127 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A Timestamp represents a point in time independent of any time zone or local - # calendar, encoded as a count of seconds and fractions of seconds at - # nanosecond resolution. The count is relative to an epoch at UTC midnight on - # January 1, 1970, in the proleptic Gregorian calendar which extends the - # Gregorian calendar backwards to year one. - # - # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - # second table is needed for interpretation, using a [24-hour linear - # smear](https://developers.google.com/time/smear). - # - # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - # restricting to that range, we ensure that we can convert to and from [RFC - # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - # - # # Examples - # - # Example 1: Compute Timestamp from POSIX `time()`. - # - # Timestamp timestamp; - # timestamp.set_seconds(time(NULL)); - # timestamp.set_nanos(0); - # - # Example 2: Compute Timestamp from POSIX `gettimeofday()`. - # - # struct timeval tv; - # gettimeofday(&tv, NULL); - # - # Timestamp timestamp; - # timestamp.set_seconds(tv.tv_sec); - # timestamp.set_nanos(tv.tv_usec * 1000); - # - # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - # - # FILETIME ft; - # GetSystemTimeAsFileTime(&ft); - # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - # - # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - # Timestamp timestamp; - # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - # - # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - # - # long millis = System.currentTimeMillis(); - # - # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - # .setNanos((int) ((millis % 1000) * 1000000)).build(); - # - # Example 5: Compute Timestamp from Java `Instant.now()`. - # - # Instant now = Instant.now(); - # - # Timestamp timestamp = - # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - # .setNanos(now.getNano()).build(); - # - # Example 6: Compute Timestamp from current time in Python. - # - # timestamp = Timestamp() - # timestamp.GetCurrentTime() - # - # # JSON Mapping - # - # In JSON format, the Timestamp type is encoded as a string in the - # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" - # where \\{year} is always expressed using four digits while \\{month}, \\{day}, - # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional - # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - # is required. A proto3 JSON serializer should always use UTC (as indicated by - # "Z") when printing the Timestamp type and a proto3 JSON parser should be - # able to accept both UTC and other timezones (as indicated by an offset). - # - # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - # 01:30 UTC on January 15, 2017. - # - # In JavaScript, one can convert a Date object to this format using the - # standard - # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - # method. In Python, a standard `datetime.datetime` object can be converted - # to this format using - # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - # the Joda Time's [`ISODateTimeFormat.dateTime()`]( - # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() - # ) to obtain a formatter capable of generating timestamps in this format. - # @!attribute [rw] seconds - # @return [::Integer] - # Represents seconds of UTC time since Unix epoch - # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - # 9999-12-31T23:59:59Z inclusive. - # @!attribute [rw] nanos - # @return [::Integer] - # Non-negative fractions of a second at nanosecond resolution. Negative - # second values with fractions must still have non-negative nanos values - # that count forward in time. Must be from 0 to 999,999,999 - # inclusive. - class Timestamp - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb b/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb deleted file mode 100644 index c1a1c07eb2db..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/proto_docs/google/rpc/status.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Rpc - # The `Status` type defines a logical error model that is suitable for - # different programming environments, including REST APIs and RPC APIs. It is - # used by [gRPC](https://github.com/grpc). Each `Status` message contains - # three pieces of data: error code, error message, and error details. - # - # You can find out more about this error model and how to work with it in the - # [API Design Guide](https://cloud.google.com/apis/design/errors). - # @!attribute [rw] code - # @return [::Integer] - # The status code, which should be an enum value of - # [google.rpc.Code][google.rpc.Code]. - # @!attribute [rw] message - # @return [::String] - # A developer-facing error message, which should be in English. Any - # user-facing error message should be localized and sent in the - # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized - # by the client. - # @!attribute [rw] details - # @return [::Array<::Google::Protobuf::Any>] - # A list of messages that carry the error details. There is a common set of - # message types for APIs to use. - class Status - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile b/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile deleted file mode 100644 index bdff294d3cff..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/Gemfile +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -source "https://rubygems.org" - -if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" - gem "google-cloud-translate-v3", path: "../" -else - gem "google-cloud-translate-v3" -end - -group :test do - gem "google-style", "~> 1.26.1" - gem "minitest", "~> 5.16" - gem "minitest-focus", "~> 1.1" - gem "minitest-hooks", "~> 1.5" -end diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json b/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json deleted file mode 100644 index c234e2a00fb6..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/snippet_metadata_google.cloud.translation.v3.json +++ /dev/null @@ -1,1535 +0,0 @@ -{ - "client_library": { - "name": "google-cloud-translate-v3", - "version": "", - "language": "RUBY", - "apis": [ - { - "id": "google.cloud.translation.v3", - "version": "v3" - } - ] - }, - "snippets": [ - { - "region_tag": "translate_v3_generated_TranslationService_TranslateText_sync", - "title": "Snippet for the translate_text call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_text.", - "file": "translation_service/translate_text.rb", - "language": "RUBY", - "client_method": { - "short_name": "translate_text", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#translate_text", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::TranslateTextRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::TranslateTextResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "TranslateText", - "full_name": "google.cloud.translation.v3.TranslationService.TranslateText", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_RomanizeText_sync", - "title": "Snippet for the romanize_text call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#romanize_text.", - "file": "translation_service/romanize_text.rb", - "language": "RUBY", - "client_method": { - "short_name": "romanize_text", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#romanize_text", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::RomanizeTextRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::RomanizeTextResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "RomanizeText", - "full_name": "google.cloud.translation.v3.TranslationService.RomanizeText", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DetectLanguage_sync", - "title": "Snippet for the detect_language call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#detect_language.", - "file": "translation_service/detect_language.rb", - "language": "RUBY", - "client_method": { - "short_name": "detect_language", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#detect_language", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DetectLanguageRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::DetectLanguageResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DetectLanguage", - "full_name": "google.cloud.translation.v3.TranslationService.DetectLanguage", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetSupportedLanguages_sync", - "title": "Snippet for the get_supported_languages call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages.", - "file": "translation_service/get_supported_languages.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_supported_languages", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::SupportedLanguages", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetSupportedLanguages", - "full_name": "google.cloud.translation.v3.TranslationService.GetSupportedLanguages", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_TranslateDocument_sync", - "title": "Snippet for the translate_document call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#translate_document.", - "file": "translation_service/translate_document.rb", - "language": "RUBY", - "client_method": { - "short_name": "translate_document", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#translate_document", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::TranslateDocumentRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::TranslateDocumentResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "TranslateDocument", - "full_name": "google.cloud.translation.v3.TranslationService.TranslateDocument", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_BatchTranslateText_sync", - "title": "Snippet for the batch_translate_text call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text.", - "file": "translation_service/batch_translate_text.rb", - "language": "RUBY", - "client_method": { - "short_name": "batch_translate_text", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::BatchTranslateTextRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "BatchTranslateText", - "full_name": "google.cloud.translation.v3.TranslationService.BatchTranslateText", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_BatchTranslateDocument_sync", - "title": "Snippet for the batch_translate_document call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document.", - "file": "translation_service/batch_translate_document.rb", - "language": "RUBY", - "client_method": { - "short_name": "batch_translate_document", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "BatchTranslateDocument", - "full_name": "google.cloud.translation.v3.TranslationService.BatchTranslateDocument", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_CreateGlossary_sync", - "title": "Snippet for the create_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary.", - "file": "translation_service/create_glossary.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_glossary", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_glossary", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::CreateGlossaryRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "CreateGlossary", - "full_name": "google.cloud.translation.v3.TranslationService.CreateGlossary", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_UpdateGlossary_sync", - "title": "Snippet for the update_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#update_glossary.", - "file": "translation_service/update_glossary.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_glossary", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#update_glossary", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::UpdateGlossaryRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "UpdateGlossary", - "full_name": "google.cloud.translation.v3.TranslationService.UpdateGlossary", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListGlossaries_sync", - "title": "Snippet for the list_glossaries call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries.", - "file": "translation_service/list_glossaries.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_glossaries", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListGlossariesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListGlossariesResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListGlossaries", - "full_name": "google.cloud.translation.v3.TranslationService.ListGlossaries", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetGlossary_sync", - "title": "Snippet for the get_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary.", - "file": "translation_service/get_glossary.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_glossary", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_glossary", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetGlossaryRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::Glossary", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetGlossary", - "full_name": "google.cloud.translation.v3.TranslationService.GetGlossary", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteGlossary_sync", - "title": "Snippet for the delete_glossary call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary.", - "file": "translation_service/delete_glossary.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_glossary", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteGlossaryRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteGlossary", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteGlossary", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetGlossaryEntry_sync", - "title": "Snippet for the get_glossary_entry call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry.", - "file": "translation_service/get_glossary_entry.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_glossary_entry", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetGlossaryEntryRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetGlossaryEntry", - "full_name": "google.cloud.translation.v3.TranslationService.GetGlossaryEntry", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListGlossaryEntries_sync", - "title": "Snippet for the list_glossary_entries call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries.", - "file": "translation_service/list_glossary_entries.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_glossary_entries", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListGlossaryEntries", - "full_name": "google.cloud.translation.v3.TranslationService.ListGlossaryEntries", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_CreateGlossaryEntry_sync", - "title": "Snippet for the create_glossary_entry call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry.", - "file": "translation_service/create_glossary_entry.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_glossary_entry", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "CreateGlossaryEntry", - "full_name": "google.cloud.translation.v3.TranslationService.CreateGlossaryEntry", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync", - "title": "Snippet for the update_glossary_entry call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry.", - "file": "translation_service/update_glossary_entry.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_glossary_entry", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::GlossaryEntry", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "UpdateGlossaryEntry", - "full_name": "google.cloud.translation.v3.TranslationService.UpdateGlossaryEntry", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync", - "title": "Snippet for the delete_glossary_entry call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry.", - "file": "translation_service/delete_glossary_entry.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_glossary_entry", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteGlossaryEntry", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteGlossaryEntry", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_CreateDataset_sync", - "title": "Snippet for the create_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_dataset.", - "file": "translation_service/create_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::CreateDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "CreateDataset", - "full_name": "google.cloud.translation.v3.TranslationService.CreateDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetDataset_sync", - "title": "Snippet for the get_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_dataset.", - "file": "translation_service/get_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::Dataset", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetDataset", - "full_name": "google.cloud.translation.v3.TranslationService.GetDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListDatasets_sync", - "title": "Snippet for the list_datasets call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_datasets.", - "file": "translation_service/list_datasets.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_datasets", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_datasets", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListDatasetsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListDatasetsResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListDatasets", - "full_name": "google.cloud.translation.v3.TranslationService.ListDatasets", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteDataset_sync", - "title": "Snippet for the delete_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset.", - "file": "translation_service/delete_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteDataset", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync", - "title": "Snippet for the create_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset.", - "file": "translation_service/create_adaptive_mt_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_adaptive_mt_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtDataset", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "CreateAdaptiveMtDataset", - "full_name": "google.cloud.translation.v3.TranslationService.CreateAdaptiveMtDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync", - "title": "Snippet for the delete_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset.", - "file": "translation_service/delete_adaptive_mt_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_adaptive_mt_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteAdaptiveMtDataset", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync", - "title": "Snippet for the get_adaptive_mt_dataset call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset.", - "file": "translation_service/get_adaptive_mt_dataset.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_adaptive_mt_dataset", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtDataset", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetAdaptiveMtDataset", - "full_name": "google.cloud.translation.v3.TranslationService.GetAdaptiveMtDataset", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync", - "title": "Snippet for the list_adaptive_mt_datasets call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets.", - "file": "translation_service/list_adaptive_mt_datasets.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_adaptive_mt_datasets", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListAdaptiveMtDatasets", - "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtDatasets", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync", - "title": "Snippet for the adaptive_mt_translate call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate.", - "file": "translation_service/adaptive_mt_translate.rb", - "language": "RUBY", - "client_method": { - "short_name": "adaptive_mt_translate", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "AdaptiveMtTranslate", - "full_name": "google.cloud.translation.v3.TranslationService.AdaptiveMtTranslate", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync", - "title": "Snippet for the get_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file.", - "file": "translation_service/get_adaptive_mt_file.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_adaptive_mt_file", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::AdaptiveMtFile", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetAdaptiveMtFile", - "full_name": "google.cloud.translation.v3.TranslationService.GetAdaptiveMtFile", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync", - "title": "Snippet for the delete_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file.", - "file": "translation_service/delete_adaptive_mt_file.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_adaptive_mt_file", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteAdaptiveMtFile", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtFile", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync", - "title": "Snippet for the import_adaptive_mt_file call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file.", - "file": "translation_service/import_adaptive_mt_file.rb", - "language": "RUBY", - "client_method": { - "short_name": "import_adaptive_mt_file", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ImportAdaptiveMtFile", - "full_name": "google.cloud.translation.v3.TranslationService.ImportAdaptiveMtFile", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync", - "title": "Snippet for the list_adaptive_mt_files call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files.", - "file": "translation_service/list_adaptive_mt_files.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_adaptive_mt_files", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListAdaptiveMtFiles", - "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtFiles", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync", - "title": "Snippet for the list_adaptive_mt_sentences call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences.", - "file": "translation_service/list_adaptive_mt_sentences.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_adaptive_mt_sentences", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListAdaptiveMtSentences", - "full_name": "google.cloud.translation.v3.TranslationService.ListAdaptiveMtSentences", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ImportData_sync", - "title": "Snippet for the import_data call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#import_data.", - "file": "translation_service/import_data.rb", - "language": "RUBY", - "client_method": { - "short_name": "import_data", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#import_data", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ImportDataRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ImportData", - "full_name": "google.cloud.translation.v3.TranslationService.ImportData", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ExportData_sync", - "title": "Snippet for the export_data call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#export_data.", - "file": "translation_service/export_data.rb", - "language": "RUBY", - "client_method": { - "short_name": "export_data", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#export_data", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ExportDataRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ExportData", - "full_name": "google.cloud.translation.v3.TranslationService.ExportData", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListExamples_sync", - "title": "Snippet for the list_examples call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_examples.", - "file": "translation_service/list_examples.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_examples", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_examples", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListExamplesRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListExamplesResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListExamples", - "full_name": "google.cloud.translation.v3.TranslationService.ListExamples", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_CreateModel_sync", - "title": "Snippet for the create_model call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#create_model.", - "file": "translation_service/create_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_model", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#create_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::CreateModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "CreateModel", - "full_name": "google.cloud.translation.v3.TranslationService.CreateModel", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_ListModels_sync", - "title": "Snippet for the list_models call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#list_models.", - "file": "translation_service/list_models.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_models", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#list_models", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::ListModelsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::ListModelsResponse", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "ListModels", - "full_name": "google.cloud.translation.v3.TranslationService.ListModels", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_GetModel_sync", - "title": "Snippet for the get_model call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#get_model.", - "file": "translation_service/get_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_model", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#get_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::GetModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Translate::V3::Model", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "GetModel", - "full_name": "google.cloud.translation.v3.TranslationService.GetModel", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "translate_v3_generated_TranslationService_DeleteModel_sync", - "title": "Snippet for the delete_model call in the TranslationService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Translate::V3::TranslationService::Client#delete_model.", - "file": "translation_service/delete_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_model", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client#delete_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Translate::V3::DeleteModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "TranslationService::Client", - "full_name": "::Google::Cloud::Translate::V3::TranslationService::Client" - }, - "method": { - "short_name": "DeleteModel", - "full_name": "google.cloud.translation.v3.TranslationService.DeleteModel", - "service": { - "short_name": "TranslationService", - "full_name": "google.cloud.translation.v3.TranslationService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - } - ] -} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb deleted file mode 100644 index aa4ad9228411..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/adaptive_mt_translate.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the adaptive_mt_translate call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#adaptive_mt_translate. -# -def adaptive_mt_translate - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new - - # Call the adaptive_mt_translate method. - result = client.adaptive_mt_translate request - - # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. - p result -end -# [END translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb deleted file mode 100644 index 25d0fe3a2789..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_document.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_BatchTranslateDocument_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the batch_translate_document call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_document. -# -def batch_translate_document - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new - - # Call the batch_translate_document method. - result = client.batch_translate_document request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb deleted file mode 100644 index 1ed61588014c..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/batch_translate_text.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_BatchTranslateText_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the batch_translate_text call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#batch_translate_text. -# -def batch_translate_text - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new - - # Call the batch_translate_text method. - result = client.batch_translate_text request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb deleted file mode 100644 index a7e3243384ec..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_adaptive_mt_dataset.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the create_adaptive_mt_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#create_adaptive_mt_dataset. -# -def create_adaptive_mt_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new - - # Call the create_adaptive_mt_dataset method. - result = client.create_adaptive_mt_dataset request - - # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - p result -end -# [END translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb deleted file mode 100644 index 0ae3a139cb62..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_dataset.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_CreateDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the create_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#create_dataset. -# -def create_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::CreateDatasetRequest.new - - # Call the create_dataset method. - result = client.create_dataset request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_CreateDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb deleted file mode 100644 index 3ecab7c93861..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_CreateGlossary_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the create_glossary call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#create_glossary. -# -def create_glossary - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new - - # Call the create_glossary method. - result = client.create_glossary request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb deleted file mode 100644 index 9f644113a2e5..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_glossary_entry.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_CreateGlossaryEntry_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the create_glossary_entry call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#create_glossary_entry. -# -def create_glossary_entry - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new - - # Call the create_glossary_entry method. - result = client.create_glossary_entry request - - # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - p result -end -# [END translate_v3_generated_TranslationService_CreateGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb deleted file mode 100644 index f13607493059..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/create_model.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_CreateModel_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the create_model call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#create_model. -# -def create_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::CreateModelRequest.new - - # Call the create_model method. - result = client.create_model request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_CreateModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb deleted file mode 100644 index f9f940bb5044..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_dataset.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_adaptive_mt_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_dataset. -# -def delete_adaptive_mt_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new - - # Call the delete_adaptive_mt_dataset method. - result = client.delete_adaptive_mt_dataset request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb deleted file mode 100644 index 469a91f67799..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_adaptive_mt_file.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_adaptive_mt_file call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_adaptive_mt_file. -# -def delete_adaptive_mt_file - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new - - # Call the delete_adaptive_mt_file method. - result = client.delete_adaptive_mt_file request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb deleted file mode 100644 index 36188a743141..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_dataset.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_dataset. -# -def delete_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new - - # Call the delete_dataset method. - result = client.delete_dataset request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_DeleteDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb deleted file mode 100644 index 0d5258e5b7f2..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteGlossary_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_glossary call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary. -# -def delete_glossary - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new - - # Call the delete_glossary method. - result = client.delete_glossary request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb deleted file mode 100644 index f9a3a195e7df..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_glossary_entry.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_glossary_entry call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_glossary_entry. -# -def delete_glossary_entry - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new - - # Call the delete_glossary_entry method. - result = client.delete_glossary_entry request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END translate_v3_generated_TranslationService_DeleteGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb deleted file mode 100644 index f97403f97994..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/delete_model.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DeleteModel_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the delete_model call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#delete_model. -# -def delete_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DeleteModelRequest.new - - # Call the delete_model method. - result = client.delete_model request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_DeleteModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb deleted file mode 100644 index 55ecd2e01e60..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/detect_language.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_DetectLanguage_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the detect_language call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#detect_language. -# -def detect_language - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::DetectLanguageRequest.new - - # Call the detect_language method. - result = client.detect_language request - - # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. - p result -end -# [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb deleted file mode 100644 index 67e09245adad..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/export_data.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ExportData_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the export_data call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#export_data. -# -def export_data - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ExportDataRequest.new - - # Call the export_data method. - result = client.export_data request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_ExportData_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb deleted file mode 100644 index ba4e677c2358..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_dataset.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_adaptive_mt_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_dataset. -# -def get_adaptive_mt_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new - - # Call the get_adaptive_mt_dataset method. - result = client.get_adaptive_mt_dataset request - - # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. - p result -end -# [END translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb deleted file mode 100644 index 0e7ebc6cc6ec..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_adaptive_mt_file.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_adaptive_mt_file call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_adaptive_mt_file. -# -def get_adaptive_mt_file - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new - - # Call the get_adaptive_mt_file method. - result = client.get_adaptive_mt_file request - - # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. - p result -end -# [END translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb deleted file mode 100644 index 3c560b5a9f1f..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_dataset.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetDataset_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_dataset call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_dataset. -# -def get_dataset - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetDatasetRequest.new - - # Call the get_dataset method. - result = client.get_dataset request - - # The returned object is of type Google::Cloud::Translate::V3::Dataset. - p result -end -# [END translate_v3_generated_TranslationService_GetDataset_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb deleted file mode 100644 index b4d2ade127f7..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetGlossary_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_glossary call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_glossary. -# -def get_glossary - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetGlossaryRequest.new - - # Call the get_glossary method. - result = client.get_glossary request - - # The returned object is of type Google::Cloud::Translate::V3::Glossary. - p result -end -# [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb deleted file mode 100644 index 422026b30132..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_glossary_entry.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetGlossaryEntry_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_glossary_entry call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_glossary_entry. -# -def get_glossary_entry - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new - - # Call the get_glossary_entry method. - result = client.get_glossary_entry request - - # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - p result -end -# [END translate_v3_generated_TranslationService_GetGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb deleted file mode 100644 index c7ddbabd9b88..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetModel_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_model call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_model. -# -def get_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetModelRequest.new - - # Call the get_model method. - result = client.get_model request - - # The returned object is of type Google::Cloud::Translate::V3::Model. - p result -end -# [END translate_v3_generated_TranslationService_GetModel_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb deleted file mode 100644 index 3ee79de1a1de..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/get_supported_languages.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_GetSupportedLanguages_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the get_supported_languages call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#get_supported_languages. -# -def get_supported_languages - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new - - # Call the get_supported_languages method. - result = client.get_supported_languages request - - # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. - p result -end -# [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb deleted file mode 100644 index e44c710d2853..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_adaptive_mt_file.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the import_adaptive_mt_file call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#import_adaptive_mt_file. -# -def import_adaptive_mt_file - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new - - # Call the import_adaptive_mt_file method. - result = client.import_adaptive_mt_file request - - # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. - p result -end -# [END translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb deleted file mode 100644 index 5b13e7a3f486..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/import_data.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ImportData_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the import_data call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#import_data. -# -def import_data - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ImportDataRequest.new - - # Call the import_data method. - result = client.import_data request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_ImportData_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb deleted file mode 100644 index 177ce32c2628..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_datasets.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_adaptive_mt_datasets call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_datasets. -# -def list_adaptive_mt_datasets - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new - - # Call the list_adaptive_mt_datasets method. - result = client.list_adaptive_mt_datasets request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. - p item - end -end -# [END translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb deleted file mode 100644 index 29e1435d5606..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_files.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_adaptive_mt_files call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_files. -# -def list_adaptive_mt_files - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new - - # Call the list_adaptive_mt_files method. - result = client.list_adaptive_mt_files request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. - p item - end -end -# [END translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb deleted file mode 100644 index eac68d950a17..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_adaptive_mt_sentences.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_adaptive_mt_sentences call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_adaptive_mt_sentences. -# -def list_adaptive_mt_sentences - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new - - # Call the list_adaptive_mt_sentences method. - result = client.list_adaptive_mt_sentences request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. - p item - end -end -# [END translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb deleted file mode 100644 index 5e51cd9506fe..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_datasets.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListDatasets_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_datasets call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_datasets. -# -def list_datasets - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListDatasetsRequest.new - - # Call the list_datasets method. - result = client.list_datasets request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::Dataset. - p item - end -end -# [END translate_v3_generated_TranslationService_ListDatasets_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb deleted file mode 100644 index 43332205b3b9..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_examples.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListExamples_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_examples call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_examples. -# -def list_examples - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListExamplesRequest.new - - # Call the list_examples method. - result = client.list_examples request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::Example. - p item - end -end -# [END translate_v3_generated_TranslationService_ListExamples_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb deleted file mode 100644 index 74b3307718fb..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossaries.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListGlossaries_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_glossaries call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_glossaries. -# -def list_glossaries - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListGlossariesRequest.new - - # Call the list_glossaries method. - result = client.list_glossaries request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::Glossary. - p item - end -end -# [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb deleted file mode 100644 index f79260b875bb..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_glossary_entries.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListGlossaryEntries_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_glossary_entries call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_glossary_entries. -# -def list_glossary_entries - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new - - # Call the list_glossary_entries method. - result = client.list_glossary_entries request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. - p item - end -end -# [END translate_v3_generated_TranslationService_ListGlossaryEntries_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb deleted file mode 100644 index 50a7a989b9ac..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/list_models.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_ListModels_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the list_models call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#list_models. -# -def list_models - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::ListModelsRequest.new - - # Call the list_models method. - result = client.list_models request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Translate::V3::Model. - p item - end -end -# [END translate_v3_generated_TranslationService_ListModels_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb deleted file mode 100644 index 83a2d907ca73..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/romanize_text.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_RomanizeText_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the romanize_text call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#romanize_text. -# -def romanize_text - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::RomanizeTextRequest.new - - # Call the romanize_text method. - result = client.romanize_text request - - # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. - p result -end -# [END translate_v3_generated_TranslationService_RomanizeText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb deleted file mode 100644 index bb4283c41aa1..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_document.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_TranslateDocument_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the translate_document call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#translate_document. -# -def translate_document - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new - - # Call the translate_document method. - result = client.translate_document request - - # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. - p result -end -# [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb deleted file mode 100644 index 78c5e7b91c60..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/translate_text.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_TranslateText_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the translate_text call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#translate_text. -# -def translate_text - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::TranslateTextRequest.new - - # Call the translate_text method. - result = client.translate_text request - - # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. - p result -end -# [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb deleted file mode 100644 index fd1baaf19c5a..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_UpdateGlossary_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the update_glossary call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#update_glossary. -# -def update_glossary - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new - - # Call the update_glossary method. - result = client.update_glossary request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END translate_v3_generated_TranslationService_UpdateGlossary_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb b/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb deleted file mode 100644 index 8ba803b74149..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/snippets/translation_service/update_glossary_entry.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync] -require "google/cloud/translate/v3" - -## -# Snippet for the update_glossary_entry call in the TranslationService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Translate::V3::TranslationService::Client#update_glossary_entry. -# -def update_glossary_entry - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Translate::V3::TranslationService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new - - # Call the update_glossary_entry method. - result = client.update_glossary_entry request - - # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. - p result -end -# [END translate_v3_generated_TranslationService_UpdateGlossaryEntry_sync] diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb deleted file mode 100644 index 6095a4a5cd3c..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/translate/v3/translation_service_pb" -require "google/cloud/translate/v3/translation_service_services_pb" -require "google/cloud/translate/v3/translation_service" - -class ::Google::Cloud::Translate::V3::TranslationService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Translate::V3::TranslationService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb deleted file mode 100644 index 9f8a19eacf25..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_paths_test.rb +++ /dev/null @@ -1,127 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/translate/v3/translation_service" - -class ::Google::Cloud::Translate::V3::TranslationService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_adaptive_mt_dataset_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.adaptive_mt_dataset_path project: "value0", location: "value1", dataset: "value2" - assert_equal "projects/value0/locations/value1/adaptiveMtDatasets/value2", path - end - end - - def test_adaptive_mt_file_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.adaptive_mt_file_path project: "value0", location: "value1", dataset: "value2", file: "value3" - assert_equal "projects/value0/locations/value1/adaptiveMtDatasets/value2/adaptiveMtFiles/value3", path - end - end - - def test_dataset_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.dataset_path project: "value0", location: "value1", dataset: "value2" - assert_equal "projects/value0/locations/value1/datasets/value2", path - end - end - - def test_glossary_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.glossary_path project: "value0", location: "value1", glossary: "value2" - assert_equal "projects/value0/locations/value1/glossaries/value2", path - end - end - - def test_glossary_entry_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.glossary_entry_path project: "value0", location: "value1", glossary: "value2", glossary_entry: "value3" - assert_equal "projects/value0/locations/value1/glossaries/value2/glossaryEntries/value3", path - end - end - - def test_location_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.location_path project: "value0", location: "value1" - assert_equal "projects/value0/locations/value1", path - end - end - - def test_model_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.model_path project: "value0", location: "value1", model: "value2" - assert_equal "projects/value0/locations/value1/models/value2", path - end - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb deleted file mode 100644 index 4a0c75350056..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_rest_test.rb +++ /dev/null @@ -1,2229 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/translate/v3/translation_service_pb" -require "google/cloud/translate/v3/translation_service/rest" - - -class ::Google::Cloud::Translate::V3::TranslationService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_translate_text - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::TranslateTextResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - contents = ["hello world"] - mime_type = "hello world" - source_language_code = "hello world" - target_language_code = "hello world" - parent = "hello world" - model = "hello world" - glossary_config = {} - transliteration_config = {} - labels = {} - - translate_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_translate_text_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, translate_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.translate_text contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.translate_text ::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.translate_text(::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, translate_text_client_stub.call_count - end - end - end - - def test_romanize_text - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::RomanizeTextResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - contents = ["hello world"] - source_language_code = "hello world" - - romanize_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_romanize_text_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, romanize_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.romanize_text parent: parent, contents: contents, source_language_code: source_language_code do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.romanize_text ::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.romanize_text(::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, romanize_text_client_stub.call_count - end - end - end - - def test_detect_language - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::DetectLanguageResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = "hello world" - content = "hello world" - mime_type = "hello world" - labels = {} - - detect_language_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_detect_language_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, detect_language_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.detect_language parent: parent, model: model, content: content, mime_type: mime_type, labels: labels do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.detect_language ::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.detect_language(::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, detect_language_client_stub.call_count - end - end - end - - def test_get_supported_languages - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::SupportedLanguages.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - display_language_code = "hello world" - model = "hello world" - - get_supported_languages_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_supported_languages_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_supported_languages_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_supported_languages parent: parent, display_language_code: display_language_code, model: model do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_supported_languages ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_supported_languages(::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_supported_languages_client_stub.call_count - end - end - end - - def test_translate_document - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_code = "hello world" - document_input_config = {} - document_output_config = {} - model = "hello world" - glossary_config = {} - labels = {} - customized_attribution = "hello world" - is_translate_native_pdf_only = true - enable_shadow_removal_native_pdf = true - enable_rotation_correction = true - - translate_document_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_translate_document_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, translate_document_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.translate_document parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.translate_document ::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.translate_document(::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, translate_document_client_stub.call_count - end - end - end - - def test_batch_translate_text - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_codes = ["hello world"] - models = {} - input_configs = [{}] - output_config = {} - glossaries = {} - labels = {} - - batch_translate_text_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_batch_translate_text_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, batch_translate_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.batch_translate_text parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.batch_translate_text ::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.batch_translate_text(::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, batch_translate_text_client_stub.call_count - end - end - end - - def test_batch_translate_document - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_codes = ["hello world"] - input_configs = [{}] - output_config = {} - models = {} - glossaries = {} - format_conversions = {} - customized_attribution = "hello world" - enable_shadow_removal_native_pdf = true - enable_rotation_correction = true - - batch_translate_document_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_batch_translate_document_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, batch_translate_document_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.batch_translate_document parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.batch_translate_document ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.batch_translate_document(::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, batch_translate_document_client_stub.call_count - end - end - end - - def test_create_glossary - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - glossary = {} - - create_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_glossary_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.create_glossary({ parent: parent, glossary: glossary }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.create_glossary parent: parent, glossary: glossary do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.create_glossary ::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.create_glossary({ parent: parent, glossary: glossary }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.create_glossary(::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_glossary_client_stub.call_count - end - end - end - - def test_update_glossary - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - glossary = {} - update_mask = {} - - update_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_update_glossary_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.update_glossary({ glossary: glossary, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.update_glossary glossary: glossary, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.update_glossary ::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.update_glossary({ glossary: glossary, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.update_glossary(::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_glossary_client_stub.call_count - end - end - end - - def test_list_glossaries - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListGlossariesResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_glossaries_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_glossaries_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_glossaries_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_glossaries parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_glossaries ::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_glossaries(::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_glossaries_client_stub.call_count - end - end - end - - def test_get_glossary - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::Glossary.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_glossary_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_glossary({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_glossary name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_glossary ::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_glossary({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_glossary(::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_glossary_client_stub.call_count - end - end - end - - def test_delete_glossary - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_glossary_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_glossary_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_glossary({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_glossary name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_glossary ::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_glossary({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_glossary(::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_glossary_client_stub.call_count - end - end - end - - def test_get_glossary_entry - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_glossary_entry_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_glossary_entry({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_glossary_entry name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_glossary_entry ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_glossary_entry({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_glossary_entry(::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_glossary_entry_client_stub.call_count - end - end - end - - def test_list_glossary_entries - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_glossary_entries_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_glossary_entries_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_glossary_entries_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_glossary_entries parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_glossary_entries ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_glossary_entries(::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_glossary_entries_client_stub.call_count - end - end - end - - def test_create_glossary_entry - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - glossary_entry = {} - - create_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_glossary_entry_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.create_glossary_entry parent: parent, glossary_entry: glossary_entry do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.create_glossary_entry ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.create_glossary_entry(::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_glossary_entry_client_stub.call_count - end - end - end - - def test_update_glossary_entry - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::GlossaryEntry.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - glossary_entry = {} - - update_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_update_glossary_entry_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.update_glossary_entry({ glossary_entry: glossary_entry }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.update_glossary_entry glossary_entry: glossary_entry do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.update_glossary_entry ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.update_glossary_entry({ glossary_entry: glossary_entry }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.update_glossary_entry(::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_glossary_entry_client_stub.call_count - end - end - end - - def test_delete_glossary_entry - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_glossary_entry_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_glossary_entry_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_glossary_entry({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_glossary_entry name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_glossary_entry ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_glossary_entry({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_glossary_entry(::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_glossary_entry_client_stub.call_count - end - end - end - - def test_create_dataset - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - dataset = {} - - create_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.create_dataset({ parent: parent, dataset: dataset }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.create_dataset parent: parent, dataset: dataset do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.create_dataset ::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.create_dataset({ parent: parent, dataset: dataset }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.create_dataset(::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_dataset_client_stub.call_count - end - end - end - - def test_get_dataset - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::Dataset.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_dataset({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_dataset name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_dataset ::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_dataset({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_dataset(::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_dataset_client_stub.call_count - end - end - end - - def test_list_datasets - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListDatasetsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_datasets_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_datasets_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_datasets_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_datasets parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_datasets ::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_datasets(::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_datasets_client_stub.call_count - end - end - end - - def test_delete_dataset - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_dataset({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_dataset name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_dataset ::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_dataset({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_dataset(::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_dataset_client_stub.call_count - end - end - end - - def test_create_adaptive_mt_dataset - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - adaptive_mt_dataset = {} - - create_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_adaptive_mt_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.create_adaptive_mt_dataset parent: parent, adaptive_mt_dataset: adaptive_mt_dataset do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.create_adaptive_mt_dataset ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.create_adaptive_mt_dataset(::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_adaptive_mt_dataset_client_stub.call_count - end - end - end - - def test_delete_adaptive_mt_dataset - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_adaptive_mt_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_adaptive_mt_dataset({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_adaptive_mt_dataset name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_adaptive_mt_dataset ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_adaptive_mt_dataset({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_adaptive_mt_dataset(::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_adaptive_mt_dataset_client_stub.call_count - end - end - end - - def test_get_adaptive_mt_dataset - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_adaptive_mt_dataset_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_adaptive_mt_dataset_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_adaptive_mt_dataset({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_adaptive_mt_dataset name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_adaptive_mt_dataset ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_adaptive_mt_dataset({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_adaptive_mt_dataset(::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_adaptive_mt_dataset_client_stub.call_count - end - end - end - - def test_list_adaptive_mt_datasets - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_adaptive_mt_datasets_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_datasets_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_datasets_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_adaptive_mt_datasets parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_adaptive_mt_datasets ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_adaptive_mt_datasets(::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_datasets_client_stub.call_count - end - end - end - - def test_adaptive_mt_translate - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - dataset = "hello world" - content = ["hello world"] - mime_type = "hello world" - reference_sentence_config = {} - glossary_config = {} - - adaptive_mt_translate_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_adaptive_mt_translate_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, adaptive_mt_translate_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, adaptive_mt_translate_client_stub.call_count - end - end - end - - def test_get_adaptive_mt_file - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::AdaptiveMtFile.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_adaptive_mt_file_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_adaptive_mt_file({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_adaptive_mt_file name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_adaptive_mt_file ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_adaptive_mt_file({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_adaptive_mt_file(::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_adaptive_mt_file_client_stub.call_count - end - end - end - - def test_delete_adaptive_mt_file - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_adaptive_mt_file_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_adaptive_mt_file({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_adaptive_mt_file name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_adaptive_mt_file ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_adaptive_mt_file({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_adaptive_mt_file(::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_adaptive_mt_file_client_stub.call_count - end - end - end - - def test_import_adaptive_mt_file - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - file_input_source = {} - - import_adaptive_mt_file_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_import_adaptive_mt_file_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, import_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.import_adaptive_mt_file parent: parent, file_input_source: file_input_source do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.import_adaptive_mt_file ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.import_adaptive_mt_file(::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, import_adaptive_mt_file_client_stub.call_count - end - end - end - - def test_list_adaptive_mt_files - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_adaptive_mt_files_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_files_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_files_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_adaptive_mt_files parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_adaptive_mt_files ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_adaptive_mt_files(::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_files_client_stub.call_count - end - end - end - - def test_list_adaptive_mt_sentences - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_adaptive_mt_sentences_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_adaptive_mt_sentences_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_adaptive_mt_sentences_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_adaptive_mt_sentences parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_adaptive_mt_sentences ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_adaptive_mt_sentences(::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_sentences_client_stub.call_count - end - end - end - - def test_import_data - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - dataset = "hello world" - input_config = {} - - import_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_import_data_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, import_data_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.import_data({ dataset: dataset, input_config: input_config }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.import_data dataset: dataset, input_config: input_config do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.import_data ::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.import_data({ dataset: dataset, input_config: input_config }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.import_data(::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, import_data_client_stub.call_count - end - end - end - - def test_export_data - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - dataset = "hello world" - output_config = {} - - export_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_export_data_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, export_data_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.export_data({ dataset: dataset, output_config: output_config }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.export_data dataset: dataset, output_config: output_config do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.export_data ::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.export_data({ dataset: dataset, output_config: output_config }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.export_data(::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, export_data_client_stub.call_count - end - end - end - - def test_list_examples - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListExamplesResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - - list_examples_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_examples_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_examples_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_examples parent: parent, filter: filter, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_examples ::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_examples(::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_examples_client_stub.call_count - end - end - end - - def test_create_model - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = {} - - create_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_create_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.create_model({ parent: parent, model: model }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.create_model parent: parent, model: model do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.create_model ::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.create_model({ parent: parent, model: model }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.create_model(::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_model_client_stub.call_count - end - end - end - - def test_list_models - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::ListModelsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - - list_models_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_list_models_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_models_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.list_models parent: parent, filter: filter, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.list_models ::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.list_models(::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_models_client_stub.call_count - end - end - end - - def test_get_model - # Create test objects. - client_result = ::Google::Cloud::Translate::V3::Model.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_get_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.get_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.get_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.get_model ::Google::Cloud::Translate::V3::GetModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.get_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.get_model(::Google::Cloud::Translate::V3::GetModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_model_client_stub.call_count - end - end - end - - def test_delete_model - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Translate::V3::TranslationService::Rest::ServiceStub.stub :transcode_delete_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - client.delete_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - client.delete_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - client.delete_model ::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - client.delete_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - client.delete_model(::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_model_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb b/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb deleted file mode 100644 index f7ed81b66174..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/test/google/cloud/translate/v3/translation_service_test.rb +++ /dev/null @@ -1,2577 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/translate/v3/translation_service_pb" -require "google/cloud/translate/v3/translation_service" - -class ::Google::Cloud::Translate::V3::TranslationService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_translate_text - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::TranslateTextResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - contents = ["hello world"] - mime_type = "hello world" - source_language_code = "hello world" - target_language_code = "hello world" - parent = "hello world" - model = "hello world" - glossary_config = {} - transliteration_config = {} - labels = {} - - translate_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :translate_text, name - assert_kind_of ::Google::Cloud::Translate::V3::TranslateTextRequest, request - assert_equal ["hello world"], request["contents"] - assert_equal "hello world", request["mime_type"] - assert_equal "hello world", request["source_language_code"] - assert_equal "hello world", request["target_language_code"] - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["model"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig), request["glossary_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TransliterationConfig), request["transliteration_config"] - assert_equal({}, request["labels"].to_h) - refute_nil options - end - - Gapic::ServiceStub.stub :new, translate_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.translate_text contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.translate_text ::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.translate_text({ contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.translate_text(::Google::Cloud::Translate::V3::TranslateTextRequest.new(contents: contents, mime_type: mime_type, source_language_code: source_language_code, target_language_code: target_language_code, parent: parent, model: model, glossary_config: glossary_config, transliteration_config: transliteration_config, labels: labels), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, translate_text_client_stub.call_rpc_count - end - end - - def test_romanize_text - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::RomanizeTextResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - contents = ["hello world"] - source_language_code = "hello world" - - romanize_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :romanize_text, name - assert_kind_of ::Google::Cloud::Translate::V3::RomanizeTextRequest, request - assert_equal "hello world", request["parent"] - assert_equal ["hello world"], request["contents"] - assert_equal "hello world", request["source_language_code"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, romanize_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.romanize_text parent: parent, contents: contents, source_language_code: source_language_code do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.romanize_text ::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.romanize_text({ parent: parent, contents: contents, source_language_code: source_language_code }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.romanize_text(::Google::Cloud::Translate::V3::RomanizeTextRequest.new(parent: parent, contents: contents, source_language_code: source_language_code), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, romanize_text_client_stub.call_rpc_count - end - end - - def test_detect_language - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::DetectLanguageResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = "hello world" - content = "hello world" - mime_type = "hello world" - labels = {} - - detect_language_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :detect_language, name - assert_kind_of ::Google::Cloud::Translate::V3::DetectLanguageRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["model"] - assert_equal "hello world", request["content"] - assert_equal :content, request.source - assert_equal "hello world", request["mime_type"] - assert_equal({}, request["labels"].to_h) - refute_nil options - end - - Gapic::ServiceStub.stub :new, detect_language_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.detect_language parent: parent, model: model, content: content, mime_type: mime_type, labels: labels do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.detect_language ::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.detect_language({ parent: parent, model: model, content: content, mime_type: mime_type, labels: labels }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.detect_language(::Google::Cloud::Translate::V3::DetectLanguageRequest.new(parent: parent, model: model, content: content, mime_type: mime_type, labels: labels), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, detect_language_client_stub.call_rpc_count - end - end - - def test_get_supported_languages - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::SupportedLanguages.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - display_language_code = "hello world" - model = "hello world" - - get_supported_languages_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_supported_languages, name - assert_kind_of ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["display_language_code"] - assert_equal "hello world", request["model"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_supported_languages_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_supported_languages parent: parent, display_language_code: display_language_code, model: model do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_supported_languages ::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_supported_languages({ parent: parent, display_language_code: display_language_code, model: model }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_supported_languages(::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new(parent: parent, display_language_code: display_language_code, model: model), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_supported_languages_client_stub.call_rpc_count - end - end - - def test_translate_document - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::TranslateDocumentResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_code = "hello world" - document_input_config = {} - document_output_config = {} - model = "hello world" - glossary_config = {} - labels = {} - customized_attribution = "hello world" - is_translate_native_pdf_only = true - enable_shadow_removal_native_pdf = true - enable_rotation_correction = true - - translate_document_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :translate_document, name - assert_kind_of ::Google::Cloud::Translate::V3::TranslateDocumentRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["source_language_code"] - assert_equal "hello world", request["target_language_code"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DocumentInputConfig), request["document_input_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DocumentOutputConfig), request["document_output_config"] - assert_equal "hello world", request["model"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig), request["glossary_config"] - assert_equal({}, request["labels"].to_h) - assert_equal "hello world", request["customized_attribution"] - assert_equal true, request["is_translate_native_pdf_only"] - assert_equal true, request["enable_shadow_removal_native_pdf"] - assert_equal true, request["enable_rotation_correction"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, translate_document_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.translate_document parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.translate_document ::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.translate_document({ parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.translate_document(::Google::Cloud::Translate::V3::TranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_code: target_language_code, document_input_config: document_input_config, document_output_config: document_output_config, model: model, glossary_config: glossary_config, labels: labels, customized_attribution: customized_attribution, is_translate_native_pdf_only: is_translate_native_pdf_only, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, translate_document_client_stub.call_rpc_count - end - end - - def test_batch_translate_text - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_codes = ["hello world"] - models = {} - input_configs = [{}] - output_config = {} - glossaries = {} - labels = {} - - batch_translate_text_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :batch_translate_text, name - assert_kind_of ::Google::Cloud::Translate::V3::BatchTranslateTextRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["source_language_code"] - assert_equal ["hello world"], request["target_language_codes"] - assert_equal({}, request["models"].to_h) - assert_kind_of ::Google::Cloud::Translate::V3::InputConfig, request["input_configs"].first - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::OutputConfig), request["output_config"] - assert_equal({}, request["glossaries"].to_h) - assert_equal({}, request["labels"].to_h) - refute_nil options - end - - Gapic::ServiceStub.stub :new, batch_translate_text_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.batch_translate_text parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.batch_translate_text ::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.batch_translate_text({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.batch_translate_text(::Google::Cloud::Translate::V3::BatchTranslateTextRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, models: models, input_configs: input_configs, output_config: output_config, glossaries: glossaries, labels: labels), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, batch_translate_text_client_stub.call_rpc_count - end - end - - def test_batch_translate_document - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - source_language_code = "hello world" - target_language_codes = ["hello world"] - input_configs = [{}] - output_config = {} - models = {} - glossaries = {} - format_conversions = {} - customized_attribution = "hello world" - enable_shadow_removal_native_pdf = true - enable_rotation_correction = true - - batch_translate_document_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :batch_translate_document, name - assert_kind_of ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["source_language_code"] - assert_equal ["hello world"], request["target_language_codes"] - assert_kind_of ::Google::Cloud::Translate::V3::BatchDocumentInputConfig, request["input_configs"].first - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::BatchDocumentOutputConfig), request["output_config"] - assert_equal({}, request["models"].to_h) - assert_equal({}, request["glossaries"].to_h) - assert_equal({}, request["format_conversions"].to_h) - assert_equal "hello world", request["customized_attribution"] - assert_equal true, request["enable_shadow_removal_native_pdf"] - assert_equal true, request["enable_rotation_correction"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, batch_translate_document_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.batch_translate_document parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.batch_translate_document ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.batch_translate_document({ parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.batch_translate_document(::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new(parent: parent, source_language_code: source_language_code, target_language_codes: target_language_codes, input_configs: input_configs, output_config: output_config, models: models, glossaries: glossaries, format_conversions: format_conversions, customized_attribution: customized_attribution, enable_shadow_removal_native_pdf: enable_shadow_removal_native_pdf, enable_rotation_correction: enable_rotation_correction), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, batch_translate_document_client_stub.call_rpc_count - end - end - - def test_create_glossary - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - glossary = {} - - create_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_glossary, name - assert_kind_of ::Google::Cloud::Translate::V3::CreateGlossaryRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Glossary), request["glossary"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.create_glossary({ parent: parent, glossary: glossary }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.create_glossary parent: parent, glossary: glossary do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.create_glossary ::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.create_glossary({ parent: parent, glossary: glossary }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.create_glossary(::Google::Cloud::Translate::V3::CreateGlossaryRequest.new(parent: parent, glossary: glossary), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_glossary_client_stub.call_rpc_count - end - end - - def test_update_glossary - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - glossary = {} - update_mask = {} - - update_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_glossary, name - assert_kind_of ::Google::Cloud::Translate::V3::UpdateGlossaryRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Glossary), request["glossary"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.update_glossary({ glossary: glossary, update_mask: update_mask }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.update_glossary glossary: glossary, update_mask: update_mask do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.update_glossary ::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.update_glossary({ glossary: glossary, update_mask: update_mask }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.update_glossary(::Google::Cloud::Translate::V3::UpdateGlossaryRequest.new(glossary: glossary, update_mask: update_mask), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_glossary_client_stub.call_rpc_count - end - end - - def test_list_glossaries - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListGlossariesResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_glossaries_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_glossaries, name - assert_kind_of ::Google::Cloud::Translate::V3::ListGlossariesRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal "hello world", request["filter"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_glossaries_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_glossaries parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_glossaries ::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_glossaries({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_glossaries(::Google::Cloud::Translate::V3::ListGlossariesRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_glossaries_client_stub.call_rpc_count - end - end - - def test_get_glossary - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::Glossary.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_glossary, name - assert_kind_of ::Google::Cloud::Translate::V3::GetGlossaryRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_glossary({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_glossary name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_glossary ::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_glossary({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_glossary(::Google::Cloud::Translate::V3::GetGlossaryRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_glossary_client_stub.call_rpc_count - end - end - - def test_delete_glossary - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_glossary_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_glossary, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteGlossaryRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_glossary_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_glossary({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_glossary name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_glossary ::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_glossary({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_glossary(::Google::Cloud::Translate::V3::DeleteGlossaryRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_glossary_client_stub.call_rpc_count - end - end - - def test_get_glossary_entry - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_glossary_entry, name - assert_kind_of ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_glossary_entry({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_glossary_entry name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_glossary_entry ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_glossary_entry({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_glossary_entry(::Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_glossary_entry_client_stub.call_rpc_count - end - end - - def test_list_glossary_entries - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListGlossaryEntriesResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_glossary_entries_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_glossary_entries, name - assert_kind_of ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_glossary_entries_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_glossary_entries parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_glossary_entries ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_glossary_entries({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_glossary_entries(::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_glossary_entries_client_stub.call_rpc_count - end - end - - def test_create_glossary_entry - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - glossary_entry = {} - - create_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_glossary_entry, name - assert_kind_of ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::GlossaryEntry), request["glossary_entry"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.create_glossary_entry parent: parent, glossary_entry: glossary_entry do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.create_glossary_entry ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.create_glossary_entry({ parent: parent, glossary_entry: glossary_entry }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.create_glossary_entry(::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new(parent: parent, glossary_entry: glossary_entry), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_glossary_entry_client_stub.call_rpc_count - end - end - - def test_update_glossary_entry - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::GlossaryEntry.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - glossary_entry = {} - - update_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_glossary_entry, name - assert_kind_of ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::GlossaryEntry), request["glossary_entry"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.update_glossary_entry({ glossary_entry: glossary_entry }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.update_glossary_entry glossary_entry: glossary_entry do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.update_glossary_entry ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.update_glossary_entry({ glossary_entry: glossary_entry }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.update_glossary_entry(::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new(glossary_entry: glossary_entry), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_glossary_entry_client_stub.call_rpc_count - end - end - - def test_delete_glossary_entry - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_glossary_entry_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_glossary_entry, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_glossary_entry_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_glossary_entry({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_glossary_entry name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_glossary_entry ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_glossary_entry({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_glossary_entry(::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_glossary_entry_client_stub.call_rpc_count - end - end - - def test_create_dataset - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - dataset = {} - - create_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::CreateDatasetRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Dataset), request["dataset"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.create_dataset({ parent: parent, dataset: dataset }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.create_dataset parent: parent, dataset: dataset do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.create_dataset ::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.create_dataset({ parent: parent, dataset: dataset }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.create_dataset(::Google::Cloud::Translate::V3::CreateDatasetRequest.new(parent: parent, dataset: dataset), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_dataset_client_stub.call_rpc_count - end - end - - def test_get_dataset - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::Dataset.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::GetDatasetRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_dataset({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_dataset name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_dataset ::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_dataset({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_dataset(::Google::Cloud::Translate::V3::GetDatasetRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_dataset_client_stub.call_rpc_count - end - end - - def test_list_datasets - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListDatasetsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_datasets_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_datasets, name - assert_kind_of ::Google::Cloud::Translate::V3::ListDatasetsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_datasets_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_datasets parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_datasets ::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_datasets({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_datasets(::Google::Cloud::Translate::V3::ListDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_datasets_client_stub.call_rpc_count - end - end - - def test_delete_dataset - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteDatasetRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_dataset({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_dataset name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_dataset ::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_dataset({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_dataset(::Google::Cloud::Translate::V3::DeleteDatasetRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_dataset_client_stub.call_rpc_count - end - end - - def test_create_adaptive_mt_dataset - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - adaptive_mt_dataset = {} - - create_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_adaptive_mt_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtDataset), request["adaptive_mt_dataset"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.create_adaptive_mt_dataset parent: parent, adaptive_mt_dataset: adaptive_mt_dataset do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.create_adaptive_mt_dataset ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.create_adaptive_mt_dataset({ parent: parent, adaptive_mt_dataset: adaptive_mt_dataset }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.create_adaptive_mt_dataset(::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new(parent: parent, adaptive_mt_dataset: adaptive_mt_dataset), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_adaptive_mt_dataset_client_stub.call_rpc_count - end - end - - def test_delete_adaptive_mt_dataset - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_adaptive_mt_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_adaptive_mt_dataset({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_adaptive_mt_dataset name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_adaptive_mt_dataset ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_adaptive_mt_dataset({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_adaptive_mt_dataset(::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_adaptive_mt_dataset_client_stub.call_rpc_count - end - end - - def test_get_adaptive_mt_dataset - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtDataset.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_adaptive_mt_dataset_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_adaptive_mt_dataset, name - assert_kind_of ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_adaptive_mt_dataset_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_adaptive_mt_dataset({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_adaptive_mt_dataset name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_adaptive_mt_dataset ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_adaptive_mt_dataset({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_adaptive_mt_dataset(::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_adaptive_mt_dataset_client_stub.call_rpc_count - end - end - - def test_list_adaptive_mt_datasets - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_adaptive_mt_datasets_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_adaptive_mt_datasets, name - assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal "hello world", request["filter"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_adaptive_mt_datasets_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_adaptive_mt_datasets parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_adaptive_mt_datasets ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_adaptive_mt_datasets({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_adaptive_mt_datasets(::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_datasets_client_stub.call_rpc_count - end - end - - def test_adaptive_mt_translate - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - dataset = "hello world" - content = ["hello world"] - mime_type = "hello world" - reference_sentence_config = {} - glossary_config = {} - - adaptive_mt_translate_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :adaptive_mt_translate, name - assert_kind_of ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["dataset"] - assert_equal ["hello world"], request["content"] - assert_equal "hello world", request["mime_type"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig), request["reference_sentence_config"] - assert request.has_reference_sentence_config? - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig), request["glossary_config"] - assert request.has_glossary_config? - refute_nil options - end - - Gapic::ServiceStub.stub :new, adaptive_mt_translate_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.adaptive_mt_translate parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.adaptive_mt_translate ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.adaptive_mt_translate({ parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.adaptive_mt_translate(::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new(parent: parent, dataset: dataset, content: content, mime_type: mime_type, reference_sentence_config: reference_sentence_config, glossary_config: glossary_config), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, adaptive_mt_translate_client_stub.call_rpc_count - end - end - - def test_get_adaptive_mt_file - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::AdaptiveMtFile.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_adaptive_mt_file, name - assert_kind_of ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_adaptive_mt_file({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_adaptive_mt_file name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_adaptive_mt_file ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_adaptive_mt_file({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_adaptive_mt_file(::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_adaptive_mt_file_client_stub.call_rpc_count - end - end - - def test_delete_adaptive_mt_file - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_adaptive_mt_file, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_adaptive_mt_file({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_adaptive_mt_file name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_adaptive_mt_file ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_adaptive_mt_file({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_adaptive_mt_file(::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_adaptive_mt_file_client_stub.call_rpc_count - end - end - - def test_import_adaptive_mt_file - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - file_input_source = {} - - import_adaptive_mt_file_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :import_adaptive_mt_file, name - assert_kind_of ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::FileInputSource), request["file_input_source"] - assert_equal :file_input_source, request.source - refute_nil options - end - - Gapic::ServiceStub.stub :new, import_adaptive_mt_file_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.import_adaptive_mt_file parent: parent, file_input_source: file_input_source do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.import_adaptive_mt_file ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.import_adaptive_mt_file({ parent: parent, file_input_source: file_input_source }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.import_adaptive_mt_file(::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new(parent: parent, file_input_source: file_input_source), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, import_adaptive_mt_file_client_stub.call_rpc_count - end - end - - def test_list_adaptive_mt_files - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_adaptive_mt_files_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_adaptive_mt_files, name - assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_adaptive_mt_files_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_adaptive_mt_files parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_adaptive_mt_files ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_adaptive_mt_files({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_adaptive_mt_files(::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_files_client_stub.call_rpc_count - end - end - - def test_list_adaptive_mt_sentences - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_adaptive_mt_sentences_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_adaptive_mt_sentences, name - assert_kind_of ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_adaptive_mt_sentences_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_adaptive_mt_sentences parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_adaptive_mt_sentences ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_adaptive_mt_sentences({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_adaptive_mt_sentences(::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_adaptive_mt_sentences_client_stub.call_rpc_count - end - end - - def test_import_data - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - dataset = "hello world" - input_config = {} - - import_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :import_data, name - assert_kind_of ::Google::Cloud::Translate::V3::ImportDataRequest, request - assert_equal "hello world", request["dataset"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DatasetInputConfig), request["input_config"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, import_data_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.import_data({ dataset: dataset, input_config: input_config }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.import_data dataset: dataset, input_config: input_config do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.import_data ::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.import_data({ dataset: dataset, input_config: input_config }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.import_data(::Google::Cloud::Translate::V3::ImportDataRequest.new(dataset: dataset, input_config: input_config), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, import_data_client_stub.call_rpc_count - end - end - - def test_export_data - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - dataset = "hello world" - output_config = {} - - export_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :export_data, name - assert_kind_of ::Google::Cloud::Translate::V3::ExportDataRequest, request - assert_equal "hello world", request["dataset"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::DatasetOutputConfig), request["output_config"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, export_data_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.export_data({ dataset: dataset, output_config: output_config }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.export_data dataset: dataset, output_config: output_config do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.export_data ::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.export_data({ dataset: dataset, output_config: output_config }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.export_data(::Google::Cloud::Translate::V3::ExportDataRequest.new(dataset: dataset, output_config: output_config), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, export_data_client_stub.call_rpc_count - end - end - - def test_list_examples - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListExamplesResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - - list_examples_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_examples, name - assert_kind_of ::Google::Cloud::Translate::V3::ListExamplesRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_examples_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_examples parent: parent, filter: filter, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_examples ::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_examples({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_examples(::Google::Cloud::Translate::V3::ListExamplesRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_examples_client_stub.call_rpc_count - end - end - - def test_create_model - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = {} - - create_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_model, name - assert_kind_of ::Google::Cloud::Translate::V3::CreateModelRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Translate::V3::Model), request["model"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.create_model({ parent: parent, model: model }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.create_model parent: parent, model: model do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.create_model ::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.create_model({ parent: parent, model: model }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.create_model(::Google::Cloud::Translate::V3::CreateModelRequest.new(parent: parent, model: model), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_model_client_stub.call_rpc_count - end - end - - def test_list_models - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::ListModelsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - - list_models_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_models, name - assert_kind_of ::Google::Cloud::Translate::V3::ListModelsRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_models_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.list_models parent: parent, filter: filter, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.list_models ::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.list_models({ parent: parent, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.list_models(::Google::Cloud::Translate::V3::ListModelsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_models_client_stub.call_rpc_count - end - end - - def test_get_model - # Create GRPC objects. - grpc_response = ::Google::Cloud::Translate::V3::Model.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_model, name - assert_kind_of ::Google::Cloud::Translate::V3::GetModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.get_model({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - client.get_model name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.get_model ::Google::Cloud::Translate::V3::GetModelRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.get_model({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.get_model(::Google::Cloud::Translate::V3::GetModelRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_model_client_stub.call_rpc_count - end - end - - def test_delete_model - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_model, name - assert_kind_of ::Google::Cloud::Translate::V3::DeleteModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_model_client_stub do - # Create client - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - client.delete_model({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - client.delete_model name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - client.delete_model ::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - client.delete_model({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - client.delete_model(::Google::Cloud::Translate::V3::DeleteModelRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_model_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Translate::V3::TranslationService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-translate-v3/test/helper.rb b/owl-bot-staging/google-cloud-translate-v3/test/helper.rb deleted file mode 100644 index 672b337030e7..000000000000 --- a/owl-bot-staging/google-cloud-translate-v3/test/helper.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "minitest/autorun" -require "minitest/focus" -require "minitest/mock" -require "minitest/rg" - -require "grpc" - -require "ostruct"