Class: Google::Cloud::Translate::V3::TranslationService::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Translate::V3::TranslationService::Rest::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/translate/v3/translation_service/rest/client.rb
Overview
REST client for the TranslationService service.
Provides natural language translation operations.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#iam_policy_client ⇒ Google::Iam::V1::IAMPolicy::Rest::Client
readonly
Get the associated client for mix-in of the IAMPolicy.
-
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client
readonly
Get the associated client for mix-in of the Locations.
-
#operations_client ⇒ ::Google::Cloud::Translate::V3::TranslationService::Rest::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the TranslationService Client class.
Instance Method Summary collapse
-
#adaptive_mt_translate(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
Translate text using Adaptive MT.
-
#batch_translate_document(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Translates a large volume of document in asynchronous batch mode.
-
#batch_translate_text(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Translates a large volume of text in asynchronous batch mode.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the TranslationService Client instance.
-
#create_adaptive_mt_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Creates an Adaptive MT dataset.
-
#create_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Creates a Dataset.
-
#create_glossary(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Creates a glossary and returns the long-running operation.
-
#create_glossary_entry(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Creates a glossary entry.
-
#create_model(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Creates a Model.
-
#delete_adaptive_mt_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
-
#delete_adaptive_mt_file(request, options = nil) {|result, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes an AdaptiveMtFile along with its sentences.
-
#delete_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Deletes a dataset and all of its contents.
-
#delete_glossary(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
-
#delete_glossary_entry(request, options = nil) {|result, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes a single entry from the glossary.
-
#delete_model(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Deletes a model.
-
#detect_language(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::DetectLanguageResponse
Detects the language of text within a request.
-
#export_data(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Exports dataset's data to the provided output location.
-
#get_adaptive_mt_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Gets the Adaptive MT dataset.
-
#get_adaptive_mt_file(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtFile
Gets and AdaptiveMtFile.
-
#get_dataset(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::Dataset
Gets a Dataset.
-
#get_glossary(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::Glossary
Gets a glossary.
-
#get_glossary_entry(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Gets a single glossary entry by the given id.
-
#get_model(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::Model
Gets a model.
-
#get_supported_languages(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::SupportedLanguages
Returns a list of supported languages for translation.
-
#import_adaptive_mt_file(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
-
#import_data(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Import sentence pairs into translation Dataset.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new TranslationService REST client object.
-
#list_adaptive_mt_datasets(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
Lists all Adaptive MT datasets for which the caller has read permission.
-
#list_adaptive_mt_files(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
-
#list_adaptive_mt_sentences(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
Lists all AdaptiveMtSentences under a given file/dataset.
-
#list_datasets(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
Lists datasets.
-
#list_examples(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
Lists sentence pairs in the dataset.
-
#list_glossaries(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
Lists glossaries in a project.
-
#list_glossary_entries(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
List the entries for the glossary.
-
#list_models(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
Lists models.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#romanize_text(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::RomanizeTextResponse
Romanize input text written in non-Latin scripts to Latin text.
-
#translate_document(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::TranslateDocumentResponse
Translates documents in synchronous mode.
-
#translate_text(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::TranslateTextResponse
Translates input text and returns translated text.
-
#universe_domain ⇒ String
The effective universe domain.
-
#update_glossary(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Updates a glossary.
-
#update_glossary_entry(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Updates a glossary entry.
Methods included from Paths
#adaptive_mt_dataset_path, #adaptive_mt_file_path, #dataset_path, #glossary_entry_path, #glossary_path, #location_path, #model_path
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new TranslationService REST client object.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 160 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. = "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 |
Instance Attribute Details
#iam_policy_client ⇒ Google::Iam::V1::IAMPolicy::Rest::Client (readonly)
Get the associated client for mix-in of the IAMPolicy.
245 246 247 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 245 def iam_policy_client @iam_policy_client end |
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client (readonly)
Get the associated client for mix-in of the Locations.
238 239 240 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 238 def location_client @location_client end |
#operations_client ⇒ ::Google::Cloud::Translate::V3::TranslationService::Rest::Operations (readonly)
Get the associated client for long-running operations.
231 232 233 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 231 def operations_client @operations_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the TranslationService Client class.
See Configuration for a description of the configuration fields.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 66 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 |
Instance Method Details
#adaptive_mt_translate(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse #adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
Translate text using Adaptive MT.
2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2770 def adaptive_mt_translate request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.adaptive_mt_translate..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout, metadata: , retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.adaptive_mt_translate request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#batch_translate_document(request, options = nil) ⇒ ::Gapic::Operation #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) ⇒ ::Gapic::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.
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1128 def batch_translate_document request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.batch_translate_document..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.batch_translate_document.timeout, metadata: , retry_policy: @config.rpcs.batch_translate_document.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.batch_translate_document request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#batch_translate_text(request, options = nil) ⇒ ::Gapic::Operation #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) ⇒ ::Gapic::Operation
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.
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 970 def batch_translate_text request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.batch_translate_text..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.batch_translate_text.timeout, metadata: , retry_policy: @config.rpcs.batch_translate_text.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.batch_translate_text request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
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 configure.
See Configuration for a description of the configuration fields.
130 131 132 133 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 130 def configure yield @config if block_given? @config end |
#create_adaptive_mt_dataset(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset #create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Creates an Adaptive MT dataset.
2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2423 def create_adaptive_mt_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_adaptive_mt_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout, metadata: , retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.create_adaptive_mt_dataset request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#create_dataset(request, options = nil) ⇒ ::Gapic::Operation #create_dataset(parent: nil, dataset: nil) ⇒ ::Gapic::Operation
Creates a Dataset.
2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2083 def create_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_dataset.timeout, metadata: , retry_policy: @config.rpcs.create_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.create_dataset request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#create_glossary(request, options = nil) ⇒ ::Gapic::Operation #create_glossary(parent: nil, glossary: nil) ⇒ ::Gapic::Operation
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1218 def create_glossary request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_glossary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_glossary.timeout, metadata: , retry_policy: @config.rpcs.create_glossary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.create_glossary request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#create_glossary_entry(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry #create_glossary_entry(parent: nil, glossary_entry: nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Creates a glossary entry.
1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1840 def create_glossary_entry request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_glossary_entry..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout, metadata: , retry_policy: @config.rpcs.create_glossary_entry.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.create_glossary_entry request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#create_model(request, options = nil) ⇒ ::Gapic::Operation #create_model(parent: nil, model: nil) ⇒ ::Gapic::Operation
Creates a Model.
3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3565 def create_model request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_model..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_model.timeout, metadata: , retry_policy: @config.rpcs.create_model.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.create_model request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_adaptive_mt_dataset(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_adaptive_mt_dataset(name: nil) ⇒ ::Google::Protobuf::Empty
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2503 def delete_adaptive_mt_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_adaptive_mt_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout, metadata: , retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_adaptive_mt_dataset request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_adaptive_mt_file(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_adaptive_mt_file(name: nil) ⇒ ::Google::Protobuf::Empty
Deletes an AdaptiveMtFile along with its sentences.
2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2928 def delete_adaptive_mt_file request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_adaptive_mt_file..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout, metadata: , retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_adaptive_mt_file request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_dataset(request, options = nil) ⇒ ::Gapic::Operation #delete_dataset(name: nil) ⇒ ::Gapic::Operation
Deletes a dataset and all of its contents.
2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2340 def delete_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_dataset.timeout, metadata: , retry_policy: @config.rpcs.delete_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_dataset request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_glossary(request, options = nil) ⇒ ::Gapic::Operation #delete_glossary(name: nil) ⇒ ::Gapic::Operation
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1587 def delete_glossary request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_glossary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_glossary.timeout, metadata: , retry_policy: @config.rpcs.delete_glossary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_glossary request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_glossary_entry(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_glossary_entry(name: nil) ⇒ ::Google::Protobuf::Empty
Deletes a single entry from the glossary
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1996 def delete_glossary_entry request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_glossary_entry..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout, metadata: , retry_policy: @config.rpcs.delete_glossary_entry.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_glossary_entry request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_model(request, options = nil) ⇒ ::Gapic::Operation #delete_model(name: nil) ⇒ ::Gapic::Operation
Deletes a model.
3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3826 def delete_model request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_model..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_model.timeout, metadata: , retry_policy: @config.rpcs.delete_model.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.delete_model request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#detect_language(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::DetectLanguageResponse #detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) ⇒ ::Google::Cloud::Translate::V3::DetectLanguageResponse
Detects the language of text within a request.
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 570 def detect_language request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.detect_language..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.detect_language.timeout, metadata: , retry_policy: @config.rpcs.detect_language.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.detect_language request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#export_data(request, options = nil) ⇒ ::Gapic::Operation #export_data(dataset: nil, output_config: nil) ⇒ ::Gapic::Operation
Exports dataset's data to the provided output location.
3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3379 def export_data request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.export_data..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.export_data.timeout, metadata: , retry_policy: @config.rpcs.export_data.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.export_data request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_adaptive_mt_dataset(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset #get_adaptive_mt_dataset(name: nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Gets the Adaptive MT dataset.
2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2582 def get_adaptive_mt_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_adaptive_mt_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout, metadata: , retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_adaptive_mt_dataset request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_adaptive_mt_file(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtFile #get_adaptive_mt_file(name: nil) ⇒ ::Google::Cloud::Translate::V3::AdaptiveMtFile
Gets and AdaptiveMtFile
2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2849 def get_adaptive_mt_file request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_adaptive_mt_file..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout, metadata: , retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_adaptive_mt_file request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_dataset(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::Dataset #get_dataset(name: nil) ⇒ ::Google::Cloud::Translate::V3::Dataset
Gets a Dataset.
2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2163 def get_dataset request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_dataset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_dataset.timeout, metadata: , retry_policy: @config.rpcs.get_dataset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_dataset request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_glossary(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::Glossary #get_glossary(name: nil) ⇒ ::Google::Cloud::Translate::V3::Glossary
Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1500 def get_glossary request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_glossary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_glossary.timeout, metadata: , retry_policy: @config.rpcs.get_glossary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_glossary request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_glossary_entry(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry #get_glossary_entry(name: nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Gets a single glossary entry by the given id.
1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1667 def get_glossary_entry request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_glossary_entry..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout, metadata: , retry_policy: @config.rpcs.get_glossary_entry.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_glossary_entry request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_model(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::Model #get_model(name: nil) ⇒ ::Google::Cloud::Translate::V3::Model
Gets a model.
3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3741 def get_model request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_model..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_model.timeout, metadata: , retry_policy: @config.rpcs.get_model.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_model request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_supported_languages(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::SupportedLanguages #get_supported_languages(parent: nil, display_language_code: nil, model: nil) ⇒ ::Google::Cloud::Translate::V3::SupportedLanguages
Returns a list of supported languages for translation.
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 678 def get_supported_languages request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_supported_languages..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_supported_languages.timeout, metadata: , retry_policy: @config.rpcs.get_supported_languages.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.get_supported_languages request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#import_adaptive_mt_file(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse #import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) ⇒ ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3012 def import_adaptive_mt_file request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.import_adaptive_mt_file..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout, metadata: , retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.import_adaptive_mt_file request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#import_data(request, options = nil) ⇒ ::Gapic::Operation #import_data(dataset: nil, input_config: nil) ⇒ ::Gapic::Operation
Import sentence pairs into translation Dataset.
3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3289 def import_data request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.import_data..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.import_data.timeout, metadata: , retry_policy: @config.rpcs.import_data.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.import_data request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_adaptive_mt_datasets(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset> #list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
Lists all Adaptive MT datasets for which the caller has read permission.
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2677 def list_adaptive_mt_datasets request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_adaptive_mt_datasets..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout, metadata: , retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_adaptive_mt_datasets request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_adaptive_mt_files(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile> #list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3104 def list_adaptive_mt_files request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_adaptive_mt_files..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout, metadata: , retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_adaptive_mt_files request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_adaptive_mt_sentences(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence> #list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
Lists all AdaptiveMtSentences under a given file/dataset.
3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3199 def list_adaptive_mt_sentences request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_adaptive_mt_sentences..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout, metadata: , retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_adaptive_mt_sentences request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_datasets(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset> #list_datasets(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
Lists datasets.
2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 2253 def list_datasets request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_datasets..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_datasets.timeout, metadata: , retry_policy: @config.rpcs.list_datasets.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_datasets request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_datasets, "datasets", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_examples(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example> #list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
Lists sentence pairs in the dataset.
3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3475 def list_examples request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_examples..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_examples.timeout, metadata: , retry_policy: @config.rpcs.list_examples.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_examples request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_examples, "examples", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_glossaries(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary> #list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1419 def list_glossaries request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_glossaries..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_glossaries.timeout, metadata: , retry_policy: @config.rpcs.list_glossaries.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_glossaries request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossaries, "glossaries", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_glossary_entries(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry> #list_glossary_entries(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
List the entries for the glossary.
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1758 def list_glossary_entries request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_glossary_entries..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout, metadata: , retry_policy: @config.rpcs.list_glossary_entries.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_glossary_entries request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, "glossary_entries", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_models(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model> #list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
Lists models.
3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 3661 def list_models request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_models..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_models.timeout, metadata: , retry_policy: @config.rpcs.list_models.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.list_models request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_models, "models", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
252 253 254 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 252 def logger @translation_service_stub.logger end |
#romanize_text(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::RomanizeTextResponse #romanize_text(parent: nil, contents: nil, source_language_code: nil) ⇒ ::Google::Cloud::Translate::V3::RomanizeTextResponse
Romanize input text written in non-Latin scripts to Latin text.
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 457 def romanize_text request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.romanize_text..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.romanize_text.timeout, metadata: , retry_policy: @config.rpcs.romanize_text.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.romanize_text request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#translate_document(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::TranslateDocumentResponse #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) ⇒ ::Google::Cloud::Translate::V3::TranslateDocumentResponse
Translates documents in synchronous mode.
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 829 def translate_document request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.translate_document..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.translate_document.timeout, metadata: , retry_policy: @config.rpcs.translate_document.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.translate_document request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#translate_text(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::TranslateTextResponse #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) ⇒ ::Google::Cloud::Translate::V3::TranslateTextResponse
Translates input text and returns translated text.
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 365 def translate_text request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.translate_text..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.translate_text.timeout, metadata: , retry_policy: @config.rpcs.translate_text.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.translate_text request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
140 141 142 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 140 def universe_domain @translation_service_stub.universe_domain end |
#update_glossary(request, options = nil) ⇒ ::Gapic::Operation #update_glossary(glossary: nil, update_mask: nil) ⇒ ::Gapic::Operation
Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1309 def update_glossary request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_glossary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_glossary.timeout, metadata: , retry_policy: @config.rpcs.update_glossary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.update_glossary request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_glossary_entry(request, options = nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry #update_glossary_entry(glossary_entry: nil) ⇒ ::Google::Cloud::Translate::V3::GlossaryEntry
Updates a glossary entry.
1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 |
# File 'lib/google/cloud/translate/v3/translation_service/rest/client.rb', line 1918 def update_glossary_entry request, = 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 = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_glossary_entry..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"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] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout, metadata: , retry_policy: @config.rpcs.update_glossary_entry.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @translation_service_stub.update_glossary_entry request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |