google-cloud-translate-v3 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/translate/v3/adaptive_mt_pb.rb +5 -1
- data/lib/google/cloud/translate/v3/automl_translation_pb.rb +78 -0
- data/lib/google/cloud/translate/v3/bindings_override.rb +102 -0
- data/lib/google/cloud/translate/v3/common_pb.rb +7 -1
- data/lib/google/cloud/translate/v3/rest.rb +1 -0
- data/lib/google/cloud/translate/v3/translation_service/client.rb +2151 -290
- data/lib/google/cloud/translate/v3/translation_service/paths.rb +59 -0
- data/lib/google/cloud/translate/v3/translation_service/rest/client.rb +2021 -278
- data/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +1258 -180
- data/lib/google/cloud/translate/v3/translation_service/rest.rb +1 -0
- data/lib/google/cloud/translate/v3/translation_service_pb.rb +21 -3
- data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +37 -0
- data/lib/google/cloud/translate/v3/version.rb +1 -1
- data/proto_docs/google/api/client.rb +14 -10
- data/proto_docs/google/api/resource.rb +7 -2
- data/proto_docs/google/cloud/translate/v3/adaptive_mt.rb +71 -1
- data/proto_docs/google/cloud/translate/v3/automl_translation.rb +487 -0
- data/proto_docs/google/cloud/translate/v3/common.rb +78 -0
- data/proto_docs/google/cloud/translate/v3/translation_service.rb +207 -14
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- metadata +46 -2
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/errors"
|
20
20
|
require "google/cloud/translate/v3/translation_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
require "google/iam/v1"
|
21
23
|
|
22
24
|
module Google
|
23
25
|
module Cloud
|
@@ -198,6 +200,20 @@ module Google
|
|
198
200
|
interceptors: @config.interceptors,
|
199
201
|
channel_pool_config: @config.channel_pool
|
200
202
|
)
|
203
|
+
|
204
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
205
|
+
config.credentials = credentials
|
206
|
+
config.quota_project = @quota_project_id
|
207
|
+
config.endpoint = @translation_service_stub.endpoint
|
208
|
+
config.universe_domain = @translation_service_stub.universe_domain
|
209
|
+
end
|
210
|
+
|
211
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
|
212
|
+
config.credentials = credentials
|
213
|
+
config.quota_project = @quota_project_id
|
214
|
+
config.endpoint = @translation_service_stub.endpoint
|
215
|
+
config.universe_domain = @translation_service_stub.universe_domain
|
216
|
+
end
|
201
217
|
end
|
202
218
|
|
203
219
|
##
|
@@ -207,6 +223,20 @@ module Google
|
|
207
223
|
#
|
208
224
|
attr_reader :operations_client
|
209
225
|
|
226
|
+
##
|
227
|
+
# Get the associated client for mix-in of the Locations.
|
228
|
+
#
|
229
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
230
|
+
#
|
231
|
+
attr_reader :location_client
|
232
|
+
|
233
|
+
##
|
234
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
235
|
+
#
|
236
|
+
# @return [Google::Iam::V1::IAMPolicy::Client]
|
237
|
+
#
|
238
|
+
attr_reader :iam_policy_client
|
239
|
+
|
210
240
|
# Service calls
|
211
241
|
|
212
242
|
##
|
@@ -222,7 +252,7 @@ module Google
|
|
222
252
|
# @param options [::Gapic::CallOptions, ::Hash]
|
223
253
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
224
254
|
#
|
225
|
-
# @overload translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, labels: nil)
|
255
|
+
# @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)
|
226
256
|
# Pass arguments to `translate_text` via keyword arguments. Note that at
|
227
257
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
228
258
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -269,6 +299,8 @@ module Google
|
|
269
299
|
# - General (built-in) models:
|
270
300
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
271
301
|
#
|
302
|
+
# - Translation LLM models:
|
303
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
|
272
304
|
#
|
273
305
|
# For global (non-regionalized) requests, use `location-id` `global`.
|
274
306
|
# For example,
|
@@ -279,6 +311,8 @@ module Google
|
|
279
311
|
# Optional. Glossary to be applied. The glossary must be
|
280
312
|
# within the same region (have the same location-id) as the model, otherwise
|
281
313
|
# an INVALID_ARGUMENT (400) error is returned.
|
314
|
+
# @param transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash]
|
315
|
+
# Optional. Transliteration to be applied.
|
282
316
|
# @param labels [::Hash{::String => ::String}]
|
283
317
|
# Optional. The labels with user-defined metadata for the request.
|
284
318
|
#
|
@@ -355,6 +389,106 @@ module Google
|
|
355
389
|
raise ::Google::Cloud::Error.from_error(e)
|
356
390
|
end
|
357
391
|
|
392
|
+
##
|
393
|
+
# Romanize input text written in non-Latin scripts to Latin text.
|
394
|
+
#
|
395
|
+
# @overload romanize_text(request, options = nil)
|
396
|
+
# Pass arguments to `romanize_text` via a request object, either of type
|
397
|
+
# {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash.
|
398
|
+
#
|
399
|
+
# @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash]
|
400
|
+
# A request object representing the call parameters. Required. To specify no
|
401
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
402
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
403
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
404
|
+
#
|
405
|
+
# @overload romanize_text(parent: nil, contents: nil, source_language_code: nil)
|
406
|
+
# Pass arguments to `romanize_text` via keyword arguments. Note that at
|
407
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
408
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
409
|
+
#
|
410
|
+
# @param parent [::String]
|
411
|
+
# Required. Project or location to make a call. Must refer to a caller's
|
412
|
+
# project.
|
413
|
+
#
|
414
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}` or
|
415
|
+
# `projects/{project-number-or-id}`.
|
416
|
+
#
|
417
|
+
# For global calls, use `projects/{project-number-or-id}/locations/global` or
|
418
|
+
# `projects/{project-number-or-id}`.
|
419
|
+
# @param contents [::Array<::String>]
|
420
|
+
# Required. The content of the input in string format.
|
421
|
+
# @param source_language_code [::String]
|
422
|
+
# Optional. The ISO-639 language code of the input text if
|
423
|
+
# known, for example, "hi" or "zh". If the source language isn't specified,
|
424
|
+
# the API attempts to identify the source language automatically and returns
|
425
|
+
# the source language for each content in the response.
|
426
|
+
#
|
427
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
428
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::RomanizeTextResponse]
|
429
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
430
|
+
#
|
431
|
+
# @return [::Google::Cloud::Translate::V3::RomanizeTextResponse]
|
432
|
+
#
|
433
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
434
|
+
#
|
435
|
+
# @example Basic example
|
436
|
+
# require "google/cloud/translate/v3"
|
437
|
+
#
|
438
|
+
# # Create a client object. The client can be reused for multiple calls.
|
439
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
440
|
+
#
|
441
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
442
|
+
# request = Google::Cloud::Translate::V3::RomanizeTextRequest.new
|
443
|
+
#
|
444
|
+
# # Call the romanize_text method.
|
445
|
+
# result = client.romanize_text request
|
446
|
+
#
|
447
|
+
# # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse.
|
448
|
+
# p result
|
449
|
+
#
|
450
|
+
def romanize_text request, options = nil
|
451
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
452
|
+
|
453
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest
|
454
|
+
|
455
|
+
# Converts hash and nil to an options object
|
456
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
457
|
+
|
458
|
+
# Customize the options with defaults
|
459
|
+
metadata = @config.rpcs.romanize_text.metadata.to_h
|
460
|
+
|
461
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
462
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
463
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
464
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
465
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
466
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
467
|
+
|
468
|
+
header_params = {}
|
469
|
+
if request.parent
|
470
|
+
header_params["parent"] = request.parent
|
471
|
+
end
|
472
|
+
|
473
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
474
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
475
|
+
|
476
|
+
options.apply_defaults timeout: @config.rpcs.romanize_text.timeout,
|
477
|
+
metadata: metadata,
|
478
|
+
retry_policy: @config.rpcs.romanize_text.retry_policy
|
479
|
+
|
480
|
+
options.apply_defaults timeout: @config.timeout,
|
481
|
+
metadata: @config.metadata,
|
482
|
+
retry_policy: @config.retry_policy
|
483
|
+
|
484
|
+
@translation_service_stub.call_rpc :romanize_text, request, options: options do |response, operation|
|
485
|
+
yield response, operation if block_given?
|
486
|
+
return response
|
487
|
+
end
|
488
|
+
rescue ::GRPC::BadStatus => e
|
489
|
+
raise ::Google::Cloud::Error.from_error(e)
|
490
|
+
end
|
491
|
+
|
358
492
|
##
|
359
493
|
# Detects the language of text within a request.
|
360
494
|
#
|
@@ -1163,6 +1297,104 @@ module Google
|
|
1163
1297
|
raise ::Google::Cloud::Error.from_error(e)
|
1164
1298
|
end
|
1165
1299
|
|
1300
|
+
##
|
1301
|
+
# Updates a glossary. A LRO is used since the update can be async if the
|
1302
|
+
# glossary's entry file is updated.
|
1303
|
+
#
|
1304
|
+
# @overload update_glossary(request, options = nil)
|
1305
|
+
# Pass arguments to `update_glossary` via a request object, either of type
|
1306
|
+
# {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash.
|
1307
|
+
#
|
1308
|
+
# @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash]
|
1309
|
+
# A request object representing the call parameters. Required. To specify no
|
1310
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1311
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1312
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1313
|
+
#
|
1314
|
+
# @overload update_glossary(glossary: nil, update_mask: nil)
|
1315
|
+
# Pass arguments to `update_glossary` via keyword arguments. Note that at
|
1316
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1317
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1318
|
+
#
|
1319
|
+
# @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash]
|
1320
|
+
# Required. The glossary entry to update.
|
1321
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1322
|
+
# The list of fields to be updated. Currently only `display_name` and
|
1323
|
+
# 'input_config'
|
1324
|
+
#
|
1325
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1326
|
+
# @yieldparam response [::Gapic::Operation]
|
1327
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1328
|
+
#
|
1329
|
+
# @return [::Gapic::Operation]
|
1330
|
+
#
|
1331
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1332
|
+
#
|
1333
|
+
# @example Basic example
|
1334
|
+
# require "google/cloud/translate/v3"
|
1335
|
+
#
|
1336
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1337
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1338
|
+
#
|
1339
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1340
|
+
# request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new
|
1341
|
+
#
|
1342
|
+
# # Call the update_glossary method.
|
1343
|
+
# result = client.update_glossary request
|
1344
|
+
#
|
1345
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
1346
|
+
# # check the status of an operation, cancel it, or wait for results.
|
1347
|
+
# # Here is how to wait for a response.
|
1348
|
+
# result.wait_until_done! timeout: 60
|
1349
|
+
# if result.response?
|
1350
|
+
# p result.response
|
1351
|
+
# else
|
1352
|
+
# puts "No response received."
|
1353
|
+
# end
|
1354
|
+
#
|
1355
|
+
def update_glossary request, options = nil
|
1356
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1357
|
+
|
1358
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest
|
1359
|
+
|
1360
|
+
# Converts hash and nil to an options object
|
1361
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1362
|
+
|
1363
|
+
# Customize the options with defaults
|
1364
|
+
metadata = @config.rpcs.update_glossary.metadata.to_h
|
1365
|
+
|
1366
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1367
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1368
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1369
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1370
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1371
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1372
|
+
|
1373
|
+
header_params = {}
|
1374
|
+
if request.glossary&.name
|
1375
|
+
header_params["glossary.name"] = request.glossary.name
|
1376
|
+
end
|
1377
|
+
|
1378
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1379
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1380
|
+
|
1381
|
+
options.apply_defaults timeout: @config.rpcs.update_glossary.timeout,
|
1382
|
+
metadata: metadata,
|
1383
|
+
retry_policy: @config.rpcs.update_glossary.retry_policy
|
1384
|
+
|
1385
|
+
options.apply_defaults timeout: @config.timeout,
|
1386
|
+
metadata: @config.metadata,
|
1387
|
+
retry_policy: @config.retry_policy
|
1388
|
+
|
1389
|
+
@translation_service_stub.call_rpc :update_glossary, request, options: options do |response, operation|
|
1390
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1391
|
+
yield response, operation if block_given?
|
1392
|
+
return response
|
1393
|
+
end
|
1394
|
+
rescue ::GRPC::BadStatus => e
|
1395
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1396
|
+
end
|
1397
|
+
|
1166
1398
|
##
|
1167
1399
|
# Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
|
1168
1400
|
# exist.
|
@@ -1464,34 +1696,31 @@ module Google
|
|
1464
1696
|
end
|
1465
1697
|
|
1466
1698
|
##
|
1467
|
-
#
|
1699
|
+
# Gets a single glossary entry by the given id.
|
1468
1700
|
#
|
1469
|
-
# @overload
|
1470
|
-
# Pass arguments to `
|
1471
|
-
# {::Google::Cloud::Translate::V3::
|
1701
|
+
# @overload get_glossary_entry(request, options = nil)
|
1702
|
+
# Pass arguments to `get_glossary_entry` via a request object, either of type
|
1703
|
+
# {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash.
|
1472
1704
|
#
|
1473
|
-
# @param request [::Google::Cloud::Translate::V3::
|
1705
|
+
# @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash]
|
1474
1706
|
# A request object representing the call parameters. Required. To specify no
|
1475
1707
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1476
1708
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1477
1709
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1478
1710
|
#
|
1479
|
-
# @overload
|
1480
|
-
# Pass arguments to `
|
1711
|
+
# @overload get_glossary_entry(name: nil)
|
1712
|
+
# Pass arguments to `get_glossary_entry` via keyword arguments. Note that at
|
1481
1713
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1482
1714
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1483
1715
|
#
|
1484
|
-
# @param
|
1485
|
-
# Required.
|
1486
|
-
# `projects/{project-number-or-id}/locations/{location-id}`
|
1487
|
-
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
1488
|
-
# Required. The AdaptiveMtDataset to be created.
|
1716
|
+
# @param name [::String]
|
1717
|
+
# Required. The resource name of the glossary entry to get
|
1489
1718
|
#
|
1490
1719
|
# @yield [response, operation] Access the result along with the RPC operation
|
1491
|
-
# @yieldparam response [::Google::Cloud::Translate::V3::
|
1720
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1492
1721
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1493
1722
|
#
|
1494
|
-
# @return [::Google::Cloud::Translate::V3::
|
1723
|
+
# @return [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1495
1724
|
#
|
1496
1725
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1497
1726
|
#
|
@@ -1502,24 +1731,24 @@ module Google
|
|
1502
1731
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1503
1732
|
#
|
1504
1733
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1505
|
-
# request = Google::Cloud::Translate::V3::
|
1734
|
+
# request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new
|
1506
1735
|
#
|
1507
|
-
# # Call the
|
1508
|
-
# result = client.
|
1736
|
+
# # Call the get_glossary_entry method.
|
1737
|
+
# result = client.get_glossary_entry request
|
1509
1738
|
#
|
1510
|
-
# # The returned object is of type Google::Cloud::Translate::V3::
|
1739
|
+
# # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
|
1511
1740
|
# p result
|
1512
1741
|
#
|
1513
|
-
def
|
1742
|
+
def get_glossary_entry request, options = nil
|
1514
1743
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1515
1744
|
|
1516
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
1745
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest
|
1517
1746
|
|
1518
1747
|
# Converts hash and nil to an options object
|
1519
1748
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1520
1749
|
|
1521
1750
|
# Customize the options with defaults
|
1522
|
-
metadata = @config.rpcs.
|
1751
|
+
metadata = @config.rpcs.get_glossary_entry.metadata.to_h
|
1523
1752
|
|
1524
1753
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1525
1754
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1529,22 +1758,22 @@ module Google
|
|
1529
1758
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1530
1759
|
|
1531
1760
|
header_params = {}
|
1532
|
-
if request.
|
1533
|
-
header_params["
|
1761
|
+
if request.name
|
1762
|
+
header_params["name"] = request.name
|
1534
1763
|
end
|
1535
1764
|
|
1536
1765
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1537
1766
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1538
1767
|
|
1539
|
-
options.apply_defaults timeout: @config.rpcs.
|
1768
|
+
options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout,
|
1540
1769
|
metadata: metadata,
|
1541
|
-
retry_policy: @config.rpcs.
|
1770
|
+
retry_policy: @config.rpcs.get_glossary_entry.retry_policy
|
1542
1771
|
|
1543
1772
|
options.apply_defaults timeout: @config.timeout,
|
1544
1773
|
metadata: @config.metadata,
|
1545
1774
|
retry_policy: @config.retry_policy
|
1546
1775
|
|
1547
|
-
@translation_service_stub.call_rpc :
|
1776
|
+
@translation_service_stub.call_rpc :get_glossary_entry, request, options: options do |response, operation|
|
1548
1777
|
yield response, operation if block_given?
|
1549
1778
|
return response
|
1550
1779
|
end
|
@@ -1553,33 +1782,40 @@ module Google
|
|
1553
1782
|
end
|
1554
1783
|
|
1555
1784
|
##
|
1556
|
-
#
|
1557
|
-
# metadata.
|
1785
|
+
# List the entries for the glossary.
|
1558
1786
|
#
|
1559
|
-
# @overload
|
1560
|
-
# Pass arguments to `
|
1561
|
-
# {::Google::Cloud::Translate::V3::
|
1787
|
+
# @overload list_glossary_entries(request, options = nil)
|
1788
|
+
# Pass arguments to `list_glossary_entries` via a request object, either of type
|
1789
|
+
# {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash.
|
1562
1790
|
#
|
1563
|
-
# @param request [::Google::Cloud::Translate::V3::
|
1791
|
+
# @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash]
|
1564
1792
|
# A request object representing the call parameters. Required. To specify no
|
1565
1793
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1566
1794
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1567
1795
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1568
1796
|
#
|
1569
|
-
# @overload
|
1570
|
-
# Pass arguments to `
|
1797
|
+
# @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil)
|
1798
|
+
# Pass arguments to `list_glossary_entries` via keyword arguments. Note that at
|
1571
1799
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1572
1800
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1573
1801
|
#
|
1574
|
-
# @param
|
1575
|
-
# Required.
|
1576
|
-
#
|
1802
|
+
# @param parent [::String]
|
1803
|
+
# Required. The parent glossary resource name for listing the glossary's
|
1804
|
+
# entries.
|
1805
|
+
# @param page_size [::Integer]
|
1806
|
+
# Optional. Requested page size. The server may return fewer glossary entries
|
1807
|
+
# than requested. If unspecified, the server picks an appropriate default.
|
1808
|
+
# @param page_token [::String]
|
1809
|
+
# Optional. A token identifying a page of results the server should return.
|
1810
|
+
# Typically, this is the value of
|
1811
|
+
# [ListGlossaryEntriesResponse.next_page_token] returned from the previous
|
1812
|
+
# call. The first page is returned if `page_token`is empty or missing.
|
1577
1813
|
#
|
1578
1814
|
# @yield [response, operation] Access the result along with the RPC operation
|
1579
|
-
# @yieldparam response [::Google::
|
1815
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>]
|
1580
1816
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1581
1817
|
#
|
1582
|
-
# @return [::Google::
|
1818
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>]
|
1583
1819
|
#
|
1584
1820
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1585
1821
|
#
|
@@ -1590,24 +1826,28 @@ module Google
|
|
1590
1826
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1591
1827
|
#
|
1592
1828
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1593
|
-
# request = Google::Cloud::Translate::V3::
|
1829
|
+
# request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new
|
1594
1830
|
#
|
1595
|
-
# # Call the
|
1596
|
-
# result = client.
|
1831
|
+
# # Call the list_glossary_entries method.
|
1832
|
+
# result = client.list_glossary_entries request
|
1597
1833
|
#
|
1598
|
-
# # The returned object is of type
|
1599
|
-
#
|
1834
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1835
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1836
|
+
# result.each do |item|
|
1837
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry.
|
1838
|
+
# p item
|
1839
|
+
# end
|
1600
1840
|
#
|
1601
|
-
def
|
1841
|
+
def list_glossary_entries request, options = nil
|
1602
1842
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1603
1843
|
|
1604
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
1844
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest
|
1605
1845
|
|
1606
1846
|
# Converts hash and nil to an options object
|
1607
1847
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1608
1848
|
|
1609
1849
|
# Customize the options with defaults
|
1610
|
-
metadata = @config.rpcs.
|
1850
|
+
metadata = @config.rpcs.list_glossary_entries.metadata.to_h
|
1611
1851
|
|
1612
1852
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1613
1853
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1617,22 +1857,23 @@ module Google
|
|
1617
1857
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1618
1858
|
|
1619
1859
|
header_params = {}
|
1620
|
-
if request.
|
1621
|
-
header_params["
|
1860
|
+
if request.parent
|
1861
|
+
header_params["parent"] = request.parent
|
1622
1862
|
end
|
1623
1863
|
|
1624
1864
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1625
1865
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1626
1866
|
|
1627
|
-
options.apply_defaults timeout: @config.rpcs.
|
1867
|
+
options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout,
|
1628
1868
|
metadata: metadata,
|
1629
|
-
retry_policy: @config.rpcs.
|
1869
|
+
retry_policy: @config.rpcs.list_glossary_entries.retry_policy
|
1630
1870
|
|
1631
1871
|
options.apply_defaults timeout: @config.timeout,
|
1632
1872
|
metadata: @config.metadata,
|
1633
1873
|
retry_policy: @config.retry_policy
|
1634
1874
|
|
1635
|
-
@translation_service_stub.call_rpc :
|
1875
|
+
@translation_service_stub.call_rpc :list_glossary_entries, request, options: options do |response, operation|
|
1876
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, request, response, operation, options
|
1636
1877
|
yield response, operation if block_given?
|
1637
1878
|
return response
|
1638
1879
|
end
|
@@ -1641,32 +1882,33 @@ module Google
|
|
1641
1882
|
end
|
1642
1883
|
|
1643
1884
|
##
|
1644
|
-
#
|
1885
|
+
# Creates a glossary entry.
|
1645
1886
|
#
|
1646
|
-
# @overload
|
1647
|
-
# Pass arguments to `
|
1648
|
-
# {::Google::Cloud::Translate::V3::
|
1887
|
+
# @overload create_glossary_entry(request, options = nil)
|
1888
|
+
# Pass arguments to `create_glossary_entry` via a request object, either of type
|
1889
|
+
# {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash.
|
1649
1890
|
#
|
1650
|
-
# @param request [::Google::Cloud::Translate::V3::
|
1891
|
+
# @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash]
|
1651
1892
|
# A request object representing the call parameters. Required. To specify no
|
1652
1893
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1653
1894
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1654
1895
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1655
1896
|
#
|
1656
|
-
# @overload
|
1657
|
-
# Pass arguments to `
|
1897
|
+
# @overload create_glossary_entry(parent: nil, glossary_entry: nil)
|
1898
|
+
# Pass arguments to `create_glossary_entry` via keyword arguments. Note that at
|
1658
1899
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1659
1900
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1660
1901
|
#
|
1661
|
-
# @param
|
1662
|
-
# Required.
|
1663
|
-
#
|
1902
|
+
# @param parent [::String]
|
1903
|
+
# Required. The resource name of the glossary to create the entry under.
|
1904
|
+
# @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash]
|
1905
|
+
# Required. The glossary entry to create
|
1664
1906
|
#
|
1665
1907
|
# @yield [response, operation] Access the result along with the RPC operation
|
1666
|
-
# @yieldparam response [::Google::Cloud::Translate::V3::
|
1908
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1667
1909
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1668
1910
|
#
|
1669
|
-
# @return [::Google::Cloud::Translate::V3::
|
1911
|
+
# @return [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1670
1912
|
#
|
1671
1913
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1672
1914
|
#
|
@@ -1677,24 +1919,1212 @@ module Google
|
|
1677
1919
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1678
1920
|
#
|
1679
1921
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1680
|
-
# request = Google::Cloud::Translate::V3::
|
1922
|
+
# request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new
|
1681
1923
|
#
|
1682
|
-
# # Call the
|
1683
|
-
# result = client.
|
1924
|
+
# # Call the create_glossary_entry method.
|
1925
|
+
# result = client.create_glossary_entry request
|
1684
1926
|
#
|
1685
|
-
# # The returned object is of type Google::Cloud::Translate::V3::
|
1927
|
+
# # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
|
1686
1928
|
# p result
|
1687
1929
|
#
|
1688
|
-
def
|
1930
|
+
def create_glossary_entry request, options = nil
|
1689
1931
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1690
1932
|
|
1691
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
1933
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest
|
1692
1934
|
|
1693
1935
|
# Converts hash and nil to an options object
|
1694
1936
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1695
1937
|
|
1696
1938
|
# Customize the options with defaults
|
1697
|
-
metadata = @config.rpcs.
|
1939
|
+
metadata = @config.rpcs.create_glossary_entry.metadata.to_h
|
1940
|
+
|
1941
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1942
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1943
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1944
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1945
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
1946
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1947
|
+
|
1948
|
+
header_params = {}
|
1949
|
+
if request.parent
|
1950
|
+
header_params["parent"] = request.parent
|
1951
|
+
end
|
1952
|
+
|
1953
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1954
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1955
|
+
|
1956
|
+
options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout,
|
1957
|
+
metadata: metadata,
|
1958
|
+
retry_policy: @config.rpcs.create_glossary_entry.retry_policy
|
1959
|
+
|
1960
|
+
options.apply_defaults timeout: @config.timeout,
|
1961
|
+
metadata: @config.metadata,
|
1962
|
+
retry_policy: @config.retry_policy
|
1963
|
+
|
1964
|
+
@translation_service_stub.call_rpc :create_glossary_entry, request, options: options do |response, operation|
|
1965
|
+
yield response, operation if block_given?
|
1966
|
+
return response
|
1967
|
+
end
|
1968
|
+
rescue ::GRPC::BadStatus => e
|
1969
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1970
|
+
end
|
1971
|
+
|
1972
|
+
##
|
1973
|
+
# Updates a glossary entry.
|
1974
|
+
#
|
1975
|
+
# @overload update_glossary_entry(request, options = nil)
|
1976
|
+
# Pass arguments to `update_glossary_entry` via a request object, either of type
|
1977
|
+
# {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash.
|
1978
|
+
#
|
1979
|
+
# @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash]
|
1980
|
+
# A request object representing the call parameters. Required. To specify no
|
1981
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1982
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1983
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1984
|
+
#
|
1985
|
+
# @overload update_glossary_entry(glossary_entry: nil)
|
1986
|
+
# Pass arguments to `update_glossary_entry` via keyword arguments. Note that at
|
1987
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1988
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1989
|
+
#
|
1990
|
+
# @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash]
|
1991
|
+
# Required. The glossary entry to update.
|
1992
|
+
#
|
1993
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1994
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1995
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1996
|
+
#
|
1997
|
+
# @return [::Google::Cloud::Translate::V3::GlossaryEntry]
|
1998
|
+
#
|
1999
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2000
|
+
#
|
2001
|
+
# @example Basic example
|
2002
|
+
# require "google/cloud/translate/v3"
|
2003
|
+
#
|
2004
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2005
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2006
|
+
#
|
2007
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2008
|
+
# request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new
|
2009
|
+
#
|
2010
|
+
# # Call the update_glossary_entry method.
|
2011
|
+
# result = client.update_glossary_entry request
|
2012
|
+
#
|
2013
|
+
# # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
|
2014
|
+
# p result
|
2015
|
+
#
|
2016
|
+
def update_glossary_entry request, options = nil
|
2017
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2018
|
+
|
2019
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest
|
2020
|
+
|
2021
|
+
# Converts hash and nil to an options object
|
2022
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2023
|
+
|
2024
|
+
# Customize the options with defaults
|
2025
|
+
metadata = @config.rpcs.update_glossary_entry.metadata.to_h
|
2026
|
+
|
2027
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2028
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2029
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2030
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2031
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2032
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2033
|
+
|
2034
|
+
header_params = {}
|
2035
|
+
if request.glossary_entry&.name
|
2036
|
+
header_params["glossary_entry.name"] = request.glossary_entry.name
|
2037
|
+
end
|
2038
|
+
|
2039
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2040
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2041
|
+
|
2042
|
+
options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout,
|
2043
|
+
metadata: metadata,
|
2044
|
+
retry_policy: @config.rpcs.update_glossary_entry.retry_policy
|
2045
|
+
|
2046
|
+
options.apply_defaults timeout: @config.timeout,
|
2047
|
+
metadata: @config.metadata,
|
2048
|
+
retry_policy: @config.retry_policy
|
2049
|
+
|
2050
|
+
@translation_service_stub.call_rpc :update_glossary_entry, request, options: options do |response, operation|
|
2051
|
+
yield response, operation if block_given?
|
2052
|
+
return response
|
2053
|
+
end
|
2054
|
+
rescue ::GRPC::BadStatus => e
|
2055
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2056
|
+
end
|
2057
|
+
|
2058
|
+
##
|
2059
|
+
# Deletes a single entry from the glossary
|
2060
|
+
#
|
2061
|
+
# @overload delete_glossary_entry(request, options = nil)
|
2062
|
+
# Pass arguments to `delete_glossary_entry` via a request object, either of type
|
2063
|
+
# {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash.
|
2064
|
+
#
|
2065
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash]
|
2066
|
+
# A request object representing the call parameters. Required. To specify no
|
2067
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2068
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2069
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2070
|
+
#
|
2071
|
+
# @overload delete_glossary_entry(name: nil)
|
2072
|
+
# Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at
|
2073
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2074
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2075
|
+
#
|
2076
|
+
# @param name [::String]
|
2077
|
+
# Required. The resource name of the glossary entry to delete
|
2078
|
+
#
|
2079
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2080
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
2081
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2082
|
+
#
|
2083
|
+
# @return [::Google::Protobuf::Empty]
|
2084
|
+
#
|
2085
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2086
|
+
#
|
2087
|
+
# @example Basic example
|
2088
|
+
# require "google/cloud/translate/v3"
|
2089
|
+
#
|
2090
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2091
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2092
|
+
#
|
2093
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2094
|
+
# request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new
|
2095
|
+
#
|
2096
|
+
# # Call the delete_glossary_entry method.
|
2097
|
+
# result = client.delete_glossary_entry request
|
2098
|
+
#
|
2099
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2100
|
+
# p result
|
2101
|
+
#
|
2102
|
+
def delete_glossary_entry request, options = nil
|
2103
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2104
|
+
|
2105
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest
|
2106
|
+
|
2107
|
+
# Converts hash and nil to an options object
|
2108
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2109
|
+
|
2110
|
+
# Customize the options with defaults
|
2111
|
+
metadata = @config.rpcs.delete_glossary_entry.metadata.to_h
|
2112
|
+
|
2113
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2114
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2115
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2116
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2117
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2118
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2119
|
+
|
2120
|
+
header_params = {}
|
2121
|
+
if request.name
|
2122
|
+
header_params["name"] = request.name
|
2123
|
+
end
|
2124
|
+
|
2125
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2126
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2127
|
+
|
2128
|
+
options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout,
|
2129
|
+
metadata: metadata,
|
2130
|
+
retry_policy: @config.rpcs.delete_glossary_entry.retry_policy
|
2131
|
+
|
2132
|
+
options.apply_defaults timeout: @config.timeout,
|
2133
|
+
metadata: @config.metadata,
|
2134
|
+
retry_policy: @config.retry_policy
|
2135
|
+
|
2136
|
+
@translation_service_stub.call_rpc :delete_glossary_entry, request, options: options do |response, operation|
|
2137
|
+
yield response, operation if block_given?
|
2138
|
+
return response
|
2139
|
+
end
|
2140
|
+
rescue ::GRPC::BadStatus => e
|
2141
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2142
|
+
end
|
2143
|
+
|
2144
|
+
##
|
2145
|
+
# Creates a Dataset.
|
2146
|
+
#
|
2147
|
+
# @overload create_dataset(request, options = nil)
|
2148
|
+
# Pass arguments to `create_dataset` via a request object, either of type
|
2149
|
+
# {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash.
|
2150
|
+
#
|
2151
|
+
# @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash]
|
2152
|
+
# A request object representing the call parameters. Required. To specify no
|
2153
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2154
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2155
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2156
|
+
#
|
2157
|
+
# @overload create_dataset(parent: nil, dataset: nil)
|
2158
|
+
# Pass arguments to `create_dataset` via keyword arguments. Note that at
|
2159
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2160
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2161
|
+
#
|
2162
|
+
# @param parent [::String]
|
2163
|
+
# Required. The project name.
|
2164
|
+
# @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash]
|
2165
|
+
# Required. The Dataset to create.
|
2166
|
+
#
|
2167
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2168
|
+
# @yieldparam response [::Gapic::Operation]
|
2169
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2170
|
+
#
|
2171
|
+
# @return [::Gapic::Operation]
|
2172
|
+
#
|
2173
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2174
|
+
#
|
2175
|
+
# @example Basic example
|
2176
|
+
# require "google/cloud/translate/v3"
|
2177
|
+
#
|
2178
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2179
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2180
|
+
#
|
2181
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2182
|
+
# request = Google::Cloud::Translate::V3::CreateDatasetRequest.new
|
2183
|
+
#
|
2184
|
+
# # Call the create_dataset method.
|
2185
|
+
# result = client.create_dataset request
|
2186
|
+
#
|
2187
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
2188
|
+
# # check the status of an operation, cancel it, or wait for results.
|
2189
|
+
# # Here is how to wait for a response.
|
2190
|
+
# result.wait_until_done! timeout: 60
|
2191
|
+
# if result.response?
|
2192
|
+
# p result.response
|
2193
|
+
# else
|
2194
|
+
# puts "No response received."
|
2195
|
+
# end
|
2196
|
+
#
|
2197
|
+
def create_dataset request, options = nil
|
2198
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2199
|
+
|
2200
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest
|
2201
|
+
|
2202
|
+
# Converts hash and nil to an options object
|
2203
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2204
|
+
|
2205
|
+
# Customize the options with defaults
|
2206
|
+
metadata = @config.rpcs.create_dataset.metadata.to_h
|
2207
|
+
|
2208
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2209
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2210
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2211
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2212
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2213
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2214
|
+
|
2215
|
+
header_params = {}
|
2216
|
+
if request.parent
|
2217
|
+
header_params["parent"] = request.parent
|
2218
|
+
end
|
2219
|
+
|
2220
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2221
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2222
|
+
|
2223
|
+
options.apply_defaults timeout: @config.rpcs.create_dataset.timeout,
|
2224
|
+
metadata: metadata,
|
2225
|
+
retry_policy: @config.rpcs.create_dataset.retry_policy
|
2226
|
+
|
2227
|
+
options.apply_defaults timeout: @config.timeout,
|
2228
|
+
metadata: @config.metadata,
|
2229
|
+
retry_policy: @config.retry_policy
|
2230
|
+
|
2231
|
+
@translation_service_stub.call_rpc :create_dataset, request, options: options do |response, operation|
|
2232
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2233
|
+
yield response, operation if block_given?
|
2234
|
+
return response
|
2235
|
+
end
|
2236
|
+
rescue ::GRPC::BadStatus => e
|
2237
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2238
|
+
end
|
2239
|
+
|
2240
|
+
##
|
2241
|
+
# Gets a Dataset.
|
2242
|
+
#
|
2243
|
+
# @overload get_dataset(request, options = nil)
|
2244
|
+
# Pass arguments to `get_dataset` via a request object, either of type
|
2245
|
+
# {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash.
|
2246
|
+
#
|
2247
|
+
# @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash]
|
2248
|
+
# A request object representing the call parameters. Required. To specify no
|
2249
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2250
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2251
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2252
|
+
#
|
2253
|
+
# @overload get_dataset(name: nil)
|
2254
|
+
# Pass arguments to `get_dataset` via keyword arguments. Note that at
|
2255
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2256
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2257
|
+
#
|
2258
|
+
# @param name [::String]
|
2259
|
+
# Required. The resource name of the dataset to retrieve.
|
2260
|
+
#
|
2261
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2262
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::Dataset]
|
2263
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2264
|
+
#
|
2265
|
+
# @return [::Google::Cloud::Translate::V3::Dataset]
|
2266
|
+
#
|
2267
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2268
|
+
#
|
2269
|
+
# @example Basic example
|
2270
|
+
# require "google/cloud/translate/v3"
|
2271
|
+
#
|
2272
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2273
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2274
|
+
#
|
2275
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2276
|
+
# request = Google::Cloud::Translate::V3::GetDatasetRequest.new
|
2277
|
+
#
|
2278
|
+
# # Call the get_dataset method.
|
2279
|
+
# result = client.get_dataset request
|
2280
|
+
#
|
2281
|
+
# # The returned object is of type Google::Cloud::Translate::V3::Dataset.
|
2282
|
+
# p result
|
2283
|
+
#
|
2284
|
+
def get_dataset request, options = nil
|
2285
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2286
|
+
|
2287
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest
|
2288
|
+
|
2289
|
+
# Converts hash and nil to an options object
|
2290
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2291
|
+
|
2292
|
+
# Customize the options with defaults
|
2293
|
+
metadata = @config.rpcs.get_dataset.metadata.to_h
|
2294
|
+
|
2295
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2296
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2297
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2298
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2299
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2300
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2301
|
+
|
2302
|
+
header_params = {}
|
2303
|
+
if request.name
|
2304
|
+
header_params["name"] = request.name
|
2305
|
+
end
|
2306
|
+
|
2307
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2308
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2309
|
+
|
2310
|
+
options.apply_defaults timeout: @config.rpcs.get_dataset.timeout,
|
2311
|
+
metadata: metadata,
|
2312
|
+
retry_policy: @config.rpcs.get_dataset.retry_policy
|
2313
|
+
|
2314
|
+
options.apply_defaults timeout: @config.timeout,
|
2315
|
+
metadata: @config.metadata,
|
2316
|
+
retry_policy: @config.retry_policy
|
2317
|
+
|
2318
|
+
@translation_service_stub.call_rpc :get_dataset, request, options: options do |response, operation|
|
2319
|
+
yield response, operation if block_given?
|
2320
|
+
return response
|
2321
|
+
end
|
2322
|
+
rescue ::GRPC::BadStatus => e
|
2323
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2324
|
+
end
|
2325
|
+
|
2326
|
+
##
|
2327
|
+
# Lists datasets.
|
2328
|
+
#
|
2329
|
+
# @overload list_datasets(request, options = nil)
|
2330
|
+
# Pass arguments to `list_datasets` via a request object, either of type
|
2331
|
+
# {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash.
|
2332
|
+
#
|
2333
|
+
# @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash]
|
2334
|
+
# A request object representing the call parameters. Required. To specify no
|
2335
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2336
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2337
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2338
|
+
#
|
2339
|
+
# @overload list_datasets(parent: nil, page_size: nil, page_token: nil)
|
2340
|
+
# Pass arguments to `list_datasets` via keyword arguments. Note that at
|
2341
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2342
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2343
|
+
#
|
2344
|
+
# @param parent [::String]
|
2345
|
+
# Required. Name of the parent project. In form of
|
2346
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
2347
|
+
# @param page_size [::Integer]
|
2348
|
+
# Optional. Requested page size. The server can return fewer results than
|
2349
|
+
# requested.
|
2350
|
+
# @param page_token [::String]
|
2351
|
+
# Optional. A token identifying a page of results for the server to return.
|
2352
|
+
# Typically obtained from next_page_token field in the response of a
|
2353
|
+
# ListDatasets call.
|
2354
|
+
#
|
2355
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2356
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>]
|
2357
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2358
|
+
#
|
2359
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>]
|
2360
|
+
#
|
2361
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2362
|
+
#
|
2363
|
+
# @example Basic example
|
2364
|
+
# require "google/cloud/translate/v3"
|
2365
|
+
#
|
2366
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2367
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2368
|
+
#
|
2369
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2370
|
+
# request = Google::Cloud::Translate::V3::ListDatasetsRequest.new
|
2371
|
+
#
|
2372
|
+
# # Call the list_datasets method.
|
2373
|
+
# result = client.list_datasets request
|
2374
|
+
#
|
2375
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2376
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2377
|
+
# result.each do |item|
|
2378
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::Dataset.
|
2379
|
+
# p item
|
2380
|
+
# end
|
2381
|
+
#
|
2382
|
+
def list_datasets request, options = nil
|
2383
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2384
|
+
|
2385
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest
|
2386
|
+
|
2387
|
+
# Converts hash and nil to an options object
|
2388
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2389
|
+
|
2390
|
+
# Customize the options with defaults
|
2391
|
+
metadata = @config.rpcs.list_datasets.metadata.to_h
|
2392
|
+
|
2393
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2394
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2395
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2396
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2397
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2398
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2399
|
+
|
2400
|
+
header_params = {}
|
2401
|
+
if request.parent
|
2402
|
+
header_params["parent"] = request.parent
|
2403
|
+
end
|
2404
|
+
|
2405
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2406
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2407
|
+
|
2408
|
+
options.apply_defaults timeout: @config.rpcs.list_datasets.timeout,
|
2409
|
+
metadata: metadata,
|
2410
|
+
retry_policy: @config.rpcs.list_datasets.retry_policy
|
2411
|
+
|
2412
|
+
options.apply_defaults timeout: @config.timeout,
|
2413
|
+
metadata: @config.metadata,
|
2414
|
+
retry_policy: @config.retry_policy
|
2415
|
+
|
2416
|
+
@translation_service_stub.call_rpc :list_datasets, request, options: options do |response, operation|
|
2417
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_datasets, request, response, operation, options
|
2418
|
+
yield response, operation if block_given?
|
2419
|
+
return response
|
2420
|
+
end
|
2421
|
+
rescue ::GRPC::BadStatus => e
|
2422
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2423
|
+
end
|
2424
|
+
|
2425
|
+
##
|
2426
|
+
# Deletes a dataset and all of its contents.
|
2427
|
+
#
|
2428
|
+
# @overload delete_dataset(request, options = nil)
|
2429
|
+
# Pass arguments to `delete_dataset` via a request object, either of type
|
2430
|
+
# {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash.
|
2431
|
+
#
|
2432
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash]
|
2433
|
+
# A request object representing the call parameters. Required. To specify no
|
2434
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2435
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2436
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2437
|
+
#
|
2438
|
+
# @overload delete_dataset(name: nil)
|
2439
|
+
# Pass arguments to `delete_dataset` via keyword arguments. Note that at
|
2440
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2441
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2442
|
+
#
|
2443
|
+
# @param name [::String]
|
2444
|
+
# Required. The name of the dataset to delete.
|
2445
|
+
#
|
2446
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2447
|
+
# @yieldparam response [::Gapic::Operation]
|
2448
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2449
|
+
#
|
2450
|
+
# @return [::Gapic::Operation]
|
2451
|
+
#
|
2452
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2453
|
+
#
|
2454
|
+
# @example Basic example
|
2455
|
+
# require "google/cloud/translate/v3"
|
2456
|
+
#
|
2457
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2458
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2459
|
+
#
|
2460
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2461
|
+
# request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new
|
2462
|
+
#
|
2463
|
+
# # Call the delete_dataset method.
|
2464
|
+
# result = client.delete_dataset request
|
2465
|
+
#
|
2466
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
2467
|
+
# # check the status of an operation, cancel it, or wait for results.
|
2468
|
+
# # Here is how to wait for a response.
|
2469
|
+
# result.wait_until_done! timeout: 60
|
2470
|
+
# if result.response?
|
2471
|
+
# p result.response
|
2472
|
+
# else
|
2473
|
+
# puts "No response received."
|
2474
|
+
# end
|
2475
|
+
#
|
2476
|
+
def delete_dataset request, options = nil
|
2477
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2478
|
+
|
2479
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest
|
2480
|
+
|
2481
|
+
# Converts hash and nil to an options object
|
2482
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2483
|
+
|
2484
|
+
# Customize the options with defaults
|
2485
|
+
metadata = @config.rpcs.delete_dataset.metadata.to_h
|
2486
|
+
|
2487
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2488
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2489
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2490
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2491
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2492
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2493
|
+
|
2494
|
+
header_params = {}
|
2495
|
+
if request.name
|
2496
|
+
header_params["name"] = request.name
|
2497
|
+
end
|
2498
|
+
|
2499
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2500
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2501
|
+
|
2502
|
+
options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout,
|
2503
|
+
metadata: metadata,
|
2504
|
+
retry_policy: @config.rpcs.delete_dataset.retry_policy
|
2505
|
+
|
2506
|
+
options.apply_defaults timeout: @config.timeout,
|
2507
|
+
metadata: @config.metadata,
|
2508
|
+
retry_policy: @config.retry_policy
|
2509
|
+
|
2510
|
+
@translation_service_stub.call_rpc :delete_dataset, request, options: options do |response, operation|
|
2511
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2512
|
+
yield response, operation if block_given?
|
2513
|
+
return response
|
2514
|
+
end
|
2515
|
+
rescue ::GRPC::BadStatus => e
|
2516
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2517
|
+
end
|
2518
|
+
|
2519
|
+
##
|
2520
|
+
# Creates an Adaptive MT dataset.
|
2521
|
+
#
|
2522
|
+
# @overload create_adaptive_mt_dataset(request, options = nil)
|
2523
|
+
# Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
|
2524
|
+
# {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
|
2525
|
+
#
|
2526
|
+
# @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
|
2527
|
+
# A request object representing the call parameters. Required. To specify no
|
2528
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2529
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2530
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2531
|
+
#
|
2532
|
+
# @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
|
2533
|
+
# Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
|
2534
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2535
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2536
|
+
#
|
2537
|
+
# @param parent [::String]
|
2538
|
+
# Required. Name of the parent project. In form of
|
2539
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
2540
|
+
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
2541
|
+
# Required. The AdaptiveMtDataset to be created.
|
2542
|
+
#
|
2543
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2544
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
2545
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2546
|
+
#
|
2547
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
2548
|
+
#
|
2549
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2550
|
+
#
|
2551
|
+
# @example Basic example
|
2552
|
+
# require "google/cloud/translate/v3"
|
2553
|
+
#
|
2554
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2555
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2556
|
+
#
|
2557
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2558
|
+
# request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
|
2559
|
+
#
|
2560
|
+
# # Call the create_adaptive_mt_dataset method.
|
2561
|
+
# result = client.create_adaptive_mt_dataset request
|
2562
|
+
#
|
2563
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
2564
|
+
# p result
|
2565
|
+
#
|
2566
|
+
def create_adaptive_mt_dataset request, options = nil
|
2567
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2568
|
+
|
2569
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
|
2570
|
+
|
2571
|
+
# Converts hash and nil to an options object
|
2572
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2573
|
+
|
2574
|
+
# Customize the options with defaults
|
2575
|
+
metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
|
2576
|
+
|
2577
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2578
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2579
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2580
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2581
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2582
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2583
|
+
|
2584
|
+
header_params = {}
|
2585
|
+
if request.parent
|
2586
|
+
header_params["parent"] = request.parent
|
2587
|
+
end
|
2588
|
+
|
2589
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2590
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2591
|
+
|
2592
|
+
options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
|
2593
|
+
metadata: metadata,
|
2594
|
+
retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
|
2595
|
+
|
2596
|
+
options.apply_defaults timeout: @config.timeout,
|
2597
|
+
metadata: @config.metadata,
|
2598
|
+
retry_policy: @config.retry_policy
|
2599
|
+
|
2600
|
+
@translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation|
|
2601
|
+
yield response, operation if block_given?
|
2602
|
+
return response
|
2603
|
+
end
|
2604
|
+
rescue ::GRPC::BadStatus => e
|
2605
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2606
|
+
end
|
2607
|
+
|
2608
|
+
##
|
2609
|
+
# Deletes an Adaptive MT dataset, including all its entries and associated
|
2610
|
+
# metadata.
|
2611
|
+
#
|
2612
|
+
# @overload delete_adaptive_mt_dataset(request, options = nil)
|
2613
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
|
2614
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
|
2615
|
+
#
|
2616
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
|
2617
|
+
# A request object representing the call parameters. Required. To specify no
|
2618
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2619
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2620
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2621
|
+
#
|
2622
|
+
# @overload delete_adaptive_mt_dataset(name: nil)
|
2623
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
|
2624
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2625
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2626
|
+
#
|
2627
|
+
# @param name [::String]
|
2628
|
+
# Required. Name of the dataset. In the form of
|
2629
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
2630
|
+
#
|
2631
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2632
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
2633
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2634
|
+
#
|
2635
|
+
# @return [::Google::Protobuf::Empty]
|
2636
|
+
#
|
2637
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2638
|
+
#
|
2639
|
+
# @example Basic example
|
2640
|
+
# require "google/cloud/translate/v3"
|
2641
|
+
#
|
2642
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2643
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2644
|
+
#
|
2645
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2646
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
|
2647
|
+
#
|
2648
|
+
# # Call the delete_adaptive_mt_dataset method.
|
2649
|
+
# result = client.delete_adaptive_mt_dataset request
|
2650
|
+
#
|
2651
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2652
|
+
# p result
|
2653
|
+
#
|
2654
|
+
def delete_adaptive_mt_dataset request, options = nil
|
2655
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2656
|
+
|
2657
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
|
2658
|
+
|
2659
|
+
# Converts hash and nil to an options object
|
2660
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2661
|
+
|
2662
|
+
# Customize the options with defaults
|
2663
|
+
metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
|
2664
|
+
|
2665
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2666
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2667
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2668
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2669
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2670
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2671
|
+
|
2672
|
+
header_params = {}
|
2673
|
+
if request.name
|
2674
|
+
header_params["name"] = request.name
|
2675
|
+
end
|
2676
|
+
|
2677
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2678
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2679
|
+
|
2680
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
|
2681
|
+
metadata: metadata,
|
2682
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
|
2683
|
+
|
2684
|
+
options.apply_defaults timeout: @config.timeout,
|
2685
|
+
metadata: @config.metadata,
|
2686
|
+
retry_policy: @config.retry_policy
|
2687
|
+
|
2688
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation|
|
2689
|
+
yield response, operation if block_given?
|
2690
|
+
return response
|
2691
|
+
end
|
2692
|
+
rescue ::GRPC::BadStatus => e
|
2693
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2694
|
+
end
|
2695
|
+
|
2696
|
+
##
|
2697
|
+
# Gets the Adaptive MT dataset.
|
2698
|
+
#
|
2699
|
+
# @overload get_adaptive_mt_dataset(request, options = nil)
|
2700
|
+
# Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
|
2701
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
|
2702
|
+
#
|
2703
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
|
2704
|
+
# A request object representing the call parameters. Required. To specify no
|
2705
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2706
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2707
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2708
|
+
#
|
2709
|
+
# @overload get_adaptive_mt_dataset(name: nil)
|
2710
|
+
# Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
|
2711
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2712
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2713
|
+
#
|
2714
|
+
# @param name [::String]
|
2715
|
+
# Required. Name of the dataset. In the form of
|
2716
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
2717
|
+
#
|
2718
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2719
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
2720
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2721
|
+
#
|
2722
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
2723
|
+
#
|
2724
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2725
|
+
#
|
2726
|
+
# @example Basic example
|
2727
|
+
# require "google/cloud/translate/v3"
|
2728
|
+
#
|
2729
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2730
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2731
|
+
#
|
2732
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2733
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
|
2734
|
+
#
|
2735
|
+
# # Call the get_adaptive_mt_dataset method.
|
2736
|
+
# result = client.get_adaptive_mt_dataset request
|
2737
|
+
#
|
2738
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
2739
|
+
# p result
|
2740
|
+
#
|
2741
|
+
def get_adaptive_mt_dataset request, options = nil
|
2742
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2743
|
+
|
2744
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
|
2745
|
+
|
2746
|
+
# Converts hash and nil to an options object
|
2747
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2748
|
+
|
2749
|
+
# Customize the options with defaults
|
2750
|
+
metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
|
2751
|
+
|
2752
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2753
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2754
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2755
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2756
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2757
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2758
|
+
|
2759
|
+
header_params = {}
|
2760
|
+
if request.name
|
2761
|
+
header_params["name"] = request.name
|
2762
|
+
end
|
2763
|
+
|
2764
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2765
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2766
|
+
|
2767
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
|
2768
|
+
metadata: metadata,
|
2769
|
+
retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
|
2770
|
+
|
2771
|
+
options.apply_defaults timeout: @config.timeout,
|
2772
|
+
metadata: @config.metadata,
|
2773
|
+
retry_policy: @config.retry_policy
|
2774
|
+
|
2775
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation|
|
2776
|
+
yield response, operation if block_given?
|
2777
|
+
return response
|
2778
|
+
end
|
2779
|
+
rescue ::GRPC::BadStatus => e
|
2780
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2781
|
+
end
|
2782
|
+
|
2783
|
+
##
|
2784
|
+
# Lists all Adaptive MT datasets for which the caller has read permission.
|
2785
|
+
#
|
2786
|
+
# @overload list_adaptive_mt_datasets(request, options = nil)
|
2787
|
+
# Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
|
2788
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
|
2789
|
+
#
|
2790
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
|
2791
|
+
# A request object representing the call parameters. Required. To specify no
|
2792
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2793
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2794
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2795
|
+
#
|
2796
|
+
# @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
2797
|
+
# Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
|
2798
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2799
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2800
|
+
#
|
2801
|
+
# @param parent [::String]
|
2802
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2803
|
+
# MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
|
2804
|
+
# @param page_size [::Integer]
|
2805
|
+
# Optional. Requested page size. The server may return fewer results than
|
2806
|
+
# requested. If unspecified, the server picks an appropriate default.
|
2807
|
+
# @param page_token [::String]
|
2808
|
+
# Optional. A token identifying a page of results the server should return.
|
2809
|
+
# Typically, this is the value of
|
2810
|
+
# ListAdaptiveMtDatasetsResponse.next_page_token returned from the
|
2811
|
+
# previous call to `ListAdaptiveMtDatasets` method. The first page is
|
2812
|
+
# returned if `page_token`is empty or missing.
|
2813
|
+
# @param filter [::String]
|
2814
|
+
# Optional. An expression for filtering the results of the request.
|
2815
|
+
# Filter is not supported yet.
|
2816
|
+
#
|
2817
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2818
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
2819
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2820
|
+
#
|
2821
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
2822
|
+
#
|
2823
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2824
|
+
#
|
2825
|
+
# @example Basic example
|
2826
|
+
# require "google/cloud/translate/v3"
|
2827
|
+
#
|
2828
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2829
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2830
|
+
#
|
2831
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2832
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
|
2833
|
+
#
|
2834
|
+
# # Call the list_adaptive_mt_datasets method.
|
2835
|
+
# result = client.list_adaptive_mt_datasets request
|
2836
|
+
#
|
2837
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2838
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2839
|
+
# result.each do |item|
|
2840
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
2841
|
+
# p item
|
2842
|
+
# end
|
2843
|
+
#
|
2844
|
+
def list_adaptive_mt_datasets request, options = nil
|
2845
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2846
|
+
|
2847
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
|
2848
|
+
|
2849
|
+
# Converts hash and nil to an options object
|
2850
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2851
|
+
|
2852
|
+
# Customize the options with defaults
|
2853
|
+
metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
|
2854
|
+
|
2855
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2856
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2857
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2858
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2859
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2860
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2861
|
+
|
2862
|
+
header_params = {}
|
2863
|
+
if request.parent
|
2864
|
+
header_params["parent"] = request.parent
|
2865
|
+
end
|
2866
|
+
|
2867
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2868
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2869
|
+
|
2870
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
|
2871
|
+
metadata: metadata,
|
2872
|
+
retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
|
2873
|
+
|
2874
|
+
options.apply_defaults timeout: @config.timeout,
|
2875
|
+
metadata: @config.metadata,
|
2876
|
+
retry_policy: @config.retry_policy
|
2877
|
+
|
2878
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation|
|
2879
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options
|
2880
|
+
yield response, operation if block_given?
|
2881
|
+
return response
|
2882
|
+
end
|
2883
|
+
rescue ::GRPC::BadStatus => e
|
2884
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2885
|
+
end
|
2886
|
+
|
2887
|
+
##
|
2888
|
+
# Translate text using Adaptive MT.
|
2889
|
+
#
|
2890
|
+
# @overload adaptive_mt_translate(request, options = nil)
|
2891
|
+
# Pass arguments to `adaptive_mt_translate` via a request object, either of type
|
2892
|
+
# {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
|
2893
|
+
#
|
2894
|
+
# @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
|
2895
|
+
# A request object representing the call parameters. Required. To specify no
|
2896
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2897
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2898
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2899
|
+
#
|
2900
|
+
# @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil)
|
2901
|
+
# Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
|
2902
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2903
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2904
|
+
#
|
2905
|
+
# @param parent [::String]
|
2906
|
+
# Required. Location to make a regional call.
|
2907
|
+
#
|
2908
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
2909
|
+
# @param dataset [::String]
|
2910
|
+
# Required. The resource name for the dataset to use for adaptive MT.
|
2911
|
+
# `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
|
2912
|
+
# @param content [::Array<::String>]
|
2913
|
+
# Required. The content of the input in string format.
|
2914
|
+
# @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash]
|
2915
|
+
# Configuration for caller provided reference sentences.
|
2916
|
+
# @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash]
|
2917
|
+
# Optional. Glossary to be applied. The glossary must be
|
2918
|
+
# within the same region (have the same location-id) as the model, otherwise
|
2919
|
+
# an INVALID_ARGUMENT (400) error is returned.
|
2920
|
+
#
|
2921
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2922
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
2923
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2924
|
+
#
|
2925
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
2926
|
+
#
|
2927
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2928
|
+
#
|
2929
|
+
# @example Basic example
|
2930
|
+
# require "google/cloud/translate/v3"
|
2931
|
+
#
|
2932
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2933
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2934
|
+
#
|
2935
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2936
|
+
# request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
|
2937
|
+
#
|
2938
|
+
# # Call the adaptive_mt_translate method.
|
2939
|
+
# result = client.adaptive_mt_translate request
|
2940
|
+
#
|
2941
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
|
2942
|
+
# p result
|
2943
|
+
#
|
2944
|
+
def adaptive_mt_translate request, options = nil
|
2945
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2946
|
+
|
2947
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
|
2948
|
+
|
2949
|
+
# Converts hash and nil to an options object
|
2950
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2951
|
+
|
2952
|
+
# Customize the options with defaults
|
2953
|
+
metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
|
2954
|
+
|
2955
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2956
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2957
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2958
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2959
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
2960
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2961
|
+
|
2962
|
+
header_params = {}
|
2963
|
+
if request.parent
|
2964
|
+
header_params["parent"] = request.parent
|
2965
|
+
end
|
2966
|
+
|
2967
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2968
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2969
|
+
|
2970
|
+
options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
|
2971
|
+
metadata: metadata,
|
2972
|
+
retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
|
2973
|
+
|
2974
|
+
options.apply_defaults timeout: @config.timeout,
|
2975
|
+
metadata: @config.metadata,
|
2976
|
+
retry_policy: @config.retry_policy
|
2977
|
+
|
2978
|
+
@translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation|
|
2979
|
+
yield response, operation if block_given?
|
2980
|
+
return response
|
2981
|
+
end
|
2982
|
+
rescue ::GRPC::BadStatus => e
|
2983
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2984
|
+
end
|
2985
|
+
|
2986
|
+
##
|
2987
|
+
# Gets and AdaptiveMtFile
|
2988
|
+
#
|
2989
|
+
# @overload get_adaptive_mt_file(request, options = nil)
|
2990
|
+
# Pass arguments to `get_adaptive_mt_file` via a request object, either of type
|
2991
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
|
2992
|
+
#
|
2993
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
|
2994
|
+
# A request object representing the call parameters. Required. To specify no
|
2995
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2996
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2997
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2998
|
+
#
|
2999
|
+
# @overload get_adaptive_mt_file(name: nil)
|
3000
|
+
# Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
|
3001
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3002
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
3003
|
+
#
|
3004
|
+
# @param name [::String]
|
3005
|
+
# Required. The resource name of the file, in form of
|
3006
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
3007
|
+
#
|
3008
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
3009
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
3010
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
3011
|
+
#
|
3012
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
3013
|
+
#
|
3014
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
3015
|
+
#
|
3016
|
+
# @example Basic example
|
3017
|
+
# require "google/cloud/translate/v3"
|
3018
|
+
#
|
3019
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3020
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
3021
|
+
#
|
3022
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3023
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
|
3024
|
+
#
|
3025
|
+
# # Call the get_adaptive_mt_file method.
|
3026
|
+
# result = client.get_adaptive_mt_file request
|
3027
|
+
#
|
3028
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
|
3029
|
+
# p result
|
3030
|
+
#
|
3031
|
+
def get_adaptive_mt_file request, options = nil
|
3032
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3033
|
+
|
3034
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
|
3035
|
+
|
3036
|
+
# Converts hash and nil to an options object
|
3037
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3038
|
+
|
3039
|
+
# Customize the options with defaults
|
3040
|
+
metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
|
3041
|
+
|
3042
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
3043
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3044
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3045
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
3046
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
3047
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3048
|
+
|
3049
|
+
header_params = {}
|
3050
|
+
if request.name
|
3051
|
+
header_params["name"] = request.name
|
3052
|
+
end
|
3053
|
+
|
3054
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
3055
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
3056
|
+
|
3057
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
|
3058
|
+
metadata: metadata,
|
3059
|
+
retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
|
3060
|
+
|
3061
|
+
options.apply_defaults timeout: @config.timeout,
|
3062
|
+
metadata: @config.metadata,
|
3063
|
+
retry_policy: @config.retry_policy
|
3064
|
+
|
3065
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation|
|
3066
|
+
yield response, operation if block_given?
|
3067
|
+
return response
|
3068
|
+
end
|
3069
|
+
rescue ::GRPC::BadStatus => e
|
3070
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3071
|
+
end
|
3072
|
+
|
3073
|
+
##
|
3074
|
+
# Deletes an AdaptiveMtFile along with its sentences.
|
3075
|
+
#
|
3076
|
+
# @overload delete_adaptive_mt_file(request, options = nil)
|
3077
|
+
# Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
|
3078
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
|
3079
|
+
#
|
3080
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
|
3081
|
+
# A request object representing the call parameters. Required. To specify no
|
3082
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
3083
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
3084
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
3085
|
+
#
|
3086
|
+
# @overload delete_adaptive_mt_file(name: nil)
|
3087
|
+
# Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
|
3088
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3089
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
3090
|
+
#
|
3091
|
+
# @param name [::String]
|
3092
|
+
# Required. The resource name of the file to delete, in form of
|
3093
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
3094
|
+
#
|
3095
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
3096
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
3097
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
3098
|
+
#
|
3099
|
+
# @return [::Google::Protobuf::Empty]
|
3100
|
+
#
|
3101
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
3102
|
+
#
|
3103
|
+
# @example Basic example
|
3104
|
+
# require "google/cloud/translate/v3"
|
3105
|
+
#
|
3106
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3107
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
3108
|
+
#
|
3109
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3110
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
|
3111
|
+
#
|
3112
|
+
# # Call the delete_adaptive_mt_file method.
|
3113
|
+
# result = client.delete_adaptive_mt_file request
|
3114
|
+
#
|
3115
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
3116
|
+
# p result
|
3117
|
+
#
|
3118
|
+
def delete_adaptive_mt_file request, options = nil
|
3119
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3120
|
+
|
3121
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
|
3122
|
+
|
3123
|
+
# Converts hash and nil to an options object
|
3124
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3125
|
+
|
3126
|
+
# Customize the options with defaults
|
3127
|
+
metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
|
1698
3128
|
|
1699
3129
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1700
3130
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1711,15 +3141,208 @@ module Google
|
|
1711
3141
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1712
3142
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1713
3143
|
|
1714
|
-
options.apply_defaults timeout: @config.rpcs.
|
3144
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
|
3145
|
+
metadata: metadata,
|
3146
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
|
3147
|
+
|
3148
|
+
options.apply_defaults timeout: @config.timeout,
|
3149
|
+
metadata: @config.metadata,
|
3150
|
+
retry_policy: @config.retry_policy
|
3151
|
+
|
3152
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation|
|
3153
|
+
yield response, operation if block_given?
|
3154
|
+
return response
|
3155
|
+
end
|
3156
|
+
rescue ::GRPC::BadStatus => e
|
3157
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3158
|
+
end
|
3159
|
+
|
3160
|
+
##
|
3161
|
+
# Imports an AdaptiveMtFile and adds all of its sentences into the
|
3162
|
+
# AdaptiveMtDataset.
|
3163
|
+
#
|
3164
|
+
# @overload import_adaptive_mt_file(request, options = nil)
|
3165
|
+
# Pass arguments to `import_adaptive_mt_file` via a request object, either of type
|
3166
|
+
# {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
|
3167
|
+
#
|
3168
|
+
# @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
|
3169
|
+
# A request object representing the call parameters. Required. To specify no
|
3170
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
3171
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
3172
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
3173
|
+
#
|
3174
|
+
# @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
|
3175
|
+
# Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
|
3176
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3177
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
3178
|
+
#
|
3179
|
+
# @param parent [::String]
|
3180
|
+
# Required. The resource name of the file, in form of
|
3181
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
3182
|
+
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
3183
|
+
# Inline file source.
|
3184
|
+
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
3185
|
+
# Google Cloud Storage file source.
|
3186
|
+
#
|
3187
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
3188
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
3189
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
3190
|
+
#
|
3191
|
+
# @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
3192
|
+
#
|
3193
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
3194
|
+
#
|
3195
|
+
# @example Basic example
|
3196
|
+
# require "google/cloud/translate/v3"
|
3197
|
+
#
|
3198
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3199
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
3200
|
+
#
|
3201
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3202
|
+
# request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
|
3203
|
+
#
|
3204
|
+
# # Call the import_adaptive_mt_file method.
|
3205
|
+
# result = client.import_adaptive_mt_file request
|
3206
|
+
#
|
3207
|
+
# # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
|
3208
|
+
# p result
|
3209
|
+
#
|
3210
|
+
def import_adaptive_mt_file request, options = nil
|
3211
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3212
|
+
|
3213
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
|
3214
|
+
|
3215
|
+
# Converts hash and nil to an options object
|
3216
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3217
|
+
|
3218
|
+
# Customize the options with defaults
|
3219
|
+
metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
|
3220
|
+
|
3221
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
3222
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3223
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3224
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
3225
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
3226
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3227
|
+
|
3228
|
+
header_params = {}
|
3229
|
+
if request.parent
|
3230
|
+
header_params["parent"] = request.parent
|
3231
|
+
end
|
3232
|
+
|
3233
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
3234
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
3235
|
+
|
3236
|
+
options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
|
3237
|
+
metadata: metadata,
|
3238
|
+
retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
|
3239
|
+
|
3240
|
+
options.apply_defaults timeout: @config.timeout,
|
3241
|
+
metadata: @config.metadata,
|
3242
|
+
retry_policy: @config.retry_policy
|
3243
|
+
|
3244
|
+
@translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation|
|
3245
|
+
yield response, operation if block_given?
|
3246
|
+
return response
|
3247
|
+
end
|
3248
|
+
rescue ::GRPC::BadStatus => e
|
3249
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3250
|
+
end
|
3251
|
+
|
3252
|
+
##
|
3253
|
+
# Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
3254
|
+
#
|
3255
|
+
# @overload list_adaptive_mt_files(request, options = nil)
|
3256
|
+
# Pass arguments to `list_adaptive_mt_files` via a request object, either of type
|
3257
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
|
3258
|
+
#
|
3259
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
|
3260
|
+
# A request object representing the call parameters. Required. To specify no
|
3261
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
3262
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
3263
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
3264
|
+
#
|
3265
|
+
# @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
|
3266
|
+
# Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
|
3267
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3268
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
3269
|
+
#
|
3270
|
+
# @param parent [::String]
|
3271
|
+
# Required. The resource name of the project from which to list the Adaptive
|
3272
|
+
# MT files.
|
3273
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
3274
|
+
# @param page_size [::Integer]
|
3275
|
+
# Optional.
|
3276
|
+
# @param page_token [::String]
|
3277
|
+
# Optional. A token identifying a page of results the server should return.
|
3278
|
+
# Typically, this is the value of
|
3279
|
+
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
3280
|
+
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
3281
|
+
# returned if `page_token`is empty or missing.
|
3282
|
+
#
|
3283
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
3284
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
3285
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
3286
|
+
#
|
3287
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
3288
|
+
#
|
3289
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
3290
|
+
#
|
3291
|
+
# @example Basic example
|
3292
|
+
# require "google/cloud/translate/v3"
|
3293
|
+
#
|
3294
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3295
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
3296
|
+
#
|
3297
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3298
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
|
3299
|
+
#
|
3300
|
+
# # Call the list_adaptive_mt_files method.
|
3301
|
+
# result = client.list_adaptive_mt_files request
|
3302
|
+
#
|
3303
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
3304
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
3305
|
+
# result.each do |item|
|
3306
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
3307
|
+
# p item
|
3308
|
+
# end
|
3309
|
+
#
|
3310
|
+
def list_adaptive_mt_files request, options = nil
|
3311
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3312
|
+
|
3313
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
|
3314
|
+
|
3315
|
+
# Converts hash and nil to an options object
|
3316
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3317
|
+
|
3318
|
+
# Customize the options with defaults
|
3319
|
+
metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
|
3320
|
+
|
3321
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
3322
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3323
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3324
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
3325
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
3326
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3327
|
+
|
3328
|
+
header_params = {}
|
3329
|
+
if request.parent
|
3330
|
+
header_params["parent"] = request.parent
|
3331
|
+
end
|
3332
|
+
|
3333
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
3334
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
3335
|
+
|
3336
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
|
1715
3337
|
metadata: metadata,
|
1716
|
-
retry_policy: @config.rpcs.
|
3338
|
+
retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
|
1717
3339
|
|
1718
3340
|
options.apply_defaults timeout: @config.timeout,
|
1719
3341
|
metadata: @config.metadata,
|
1720
3342
|
retry_policy: @config.retry_policy
|
1721
3343
|
|
1722
|
-
@translation_service_stub.call_rpc :
|
3344
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation|
|
3345
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options
|
1723
3346
|
yield response, operation if block_given?
|
1724
3347
|
return response
|
1725
3348
|
end
|
@@ -1728,44 +3351,42 @@ module Google
|
|
1728
3351
|
end
|
1729
3352
|
|
1730
3353
|
##
|
1731
|
-
# Lists all
|
3354
|
+
# Lists all AdaptiveMtSentences under a given file/dataset.
|
1732
3355
|
#
|
1733
|
-
# @overload
|
1734
|
-
# Pass arguments to `
|
1735
|
-
# {::Google::Cloud::Translate::V3::
|
3356
|
+
# @overload list_adaptive_mt_sentences(request, options = nil)
|
3357
|
+
# Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
|
3358
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
|
1736
3359
|
#
|
1737
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3360
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
|
1738
3361
|
# A request object representing the call parameters. Required. To specify no
|
1739
3362
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1740
3363
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1741
3364
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1742
3365
|
#
|
1743
|
-
# @overload
|
1744
|
-
# Pass arguments to `
|
3366
|
+
# @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
|
3367
|
+
# Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
|
1745
3368
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1746
3369
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1747
3370
|
#
|
1748
3371
|
# @param parent [::String]
|
1749
3372
|
# Required. The resource name of the project from which to list the Adaptive
|
1750
|
-
# MT
|
3373
|
+
# MT files. The following format lists all sentences under a file.
|
3374
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
3375
|
+
# The following format lists all sentences within a dataset.
|
3376
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
1751
3377
|
# @param page_size [::Integer]
|
1752
|
-
# Optional. Requested page size. The server may return fewer results than
|
1753
|
-
# requested. If unspecified, the server picks an appropriate default.
|
1754
3378
|
# @param page_token [::String]
|
1755
|
-
#
|
3379
|
+
# A token identifying a page of results the server should return.
|
1756
3380
|
# Typically, this is the value of
|
1757
|
-
#
|
1758
|
-
# previous call to `
|
1759
|
-
# returned if `page_token`is empty or missing.
|
1760
|
-
# @param filter [::String]
|
1761
|
-
# Optional. An expression for filtering the results of the request.
|
1762
|
-
# Filter is not supported yet.
|
3381
|
+
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
3382
|
+
# previous call to `ListTranslationMemories` method. The first page is
|
3383
|
+
# returned if `page_token` is empty or missing.
|
1763
3384
|
#
|
1764
3385
|
# @yield [response, operation] Access the result along with the RPC operation
|
1765
|
-
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::
|
3386
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
1766
3387
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1767
3388
|
#
|
1768
|
-
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::
|
3389
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
1769
3390
|
#
|
1770
3391
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1771
3392
|
#
|
@@ -1776,28 +3397,28 @@ module Google
|
|
1776
3397
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1777
3398
|
#
|
1778
3399
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1779
|
-
# request = Google::Cloud::Translate::V3::
|
3400
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
|
1780
3401
|
#
|
1781
|
-
# # Call the
|
1782
|
-
# result = client.
|
3402
|
+
# # Call the list_adaptive_mt_sentences method.
|
3403
|
+
# result = client.list_adaptive_mt_sentences request
|
1783
3404
|
#
|
1784
3405
|
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1785
3406
|
# # over elements, and API calls will be issued to fetch pages as needed.
|
1786
3407
|
# result.each do |item|
|
1787
|
-
# # Each element is of type ::Google::Cloud::Translate::V3::
|
3408
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
|
1788
3409
|
# p item
|
1789
3410
|
# end
|
1790
3411
|
#
|
1791
|
-
def
|
3412
|
+
def list_adaptive_mt_sentences request, options = nil
|
1792
3413
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1793
3414
|
|
1794
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3415
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
|
1795
3416
|
|
1796
3417
|
# Converts hash and nil to an options object
|
1797
3418
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1798
3419
|
|
1799
3420
|
# Customize the options with defaults
|
1800
|
-
metadata = @config.rpcs.
|
3421
|
+
metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
|
1801
3422
|
|
1802
3423
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1803
3424
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1814,16 +3435,16 @@ module Google
|
|
1814
3435
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1815
3436
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1816
3437
|
|
1817
|
-
options.apply_defaults timeout: @config.rpcs.
|
3438
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
|
1818
3439
|
metadata: metadata,
|
1819
|
-
retry_policy: @config.rpcs.
|
3440
|
+
retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
|
1820
3441
|
|
1821
3442
|
options.apply_defaults timeout: @config.timeout,
|
1822
3443
|
metadata: @config.metadata,
|
1823
3444
|
retry_policy: @config.retry_policy
|
1824
3445
|
|
1825
|
-
@translation_service_stub.call_rpc :
|
1826
|
-
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :
|
3446
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation|
|
3447
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options
|
1827
3448
|
yield response, operation if block_given?
|
1828
3449
|
return response
|
1829
3450
|
end
|
@@ -1832,39 +3453,131 @@ module Google
|
|
1832
3453
|
end
|
1833
3454
|
|
1834
3455
|
##
|
1835
|
-
#
|
3456
|
+
# Import sentence pairs into translation Dataset.
|
1836
3457
|
#
|
1837
|
-
# @overload
|
1838
|
-
# Pass arguments to `
|
1839
|
-
# {::Google::Cloud::Translate::V3::
|
3458
|
+
# @overload import_data(request, options = nil)
|
3459
|
+
# Pass arguments to `import_data` via a request object, either of type
|
3460
|
+
# {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash.
|
1840
3461
|
#
|
1841
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3462
|
+
# @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash]
|
1842
3463
|
# A request object representing the call parameters. Required. To specify no
|
1843
3464
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1844
3465
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1845
3466
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1846
3467
|
#
|
1847
|
-
# @overload
|
1848
|
-
# Pass arguments to `
|
3468
|
+
# @overload import_data(dataset: nil, input_config: nil)
|
3469
|
+
# Pass arguments to `import_data` via keyword arguments. Note that at
|
1849
3470
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1850
3471
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1851
3472
|
#
|
1852
|
-
# @param
|
1853
|
-
# Required.
|
3473
|
+
# @param dataset [::String]
|
3474
|
+
# Required. Name of the dataset. In form of
|
3475
|
+
# `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
|
3476
|
+
# @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash]
|
3477
|
+
# Required. The config for the input content.
|
3478
|
+
#
|
3479
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
3480
|
+
# @yieldparam response [::Gapic::Operation]
|
3481
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
3482
|
+
#
|
3483
|
+
# @return [::Gapic::Operation]
|
3484
|
+
#
|
3485
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
3486
|
+
#
|
3487
|
+
# @example Basic example
|
3488
|
+
# require "google/cloud/translate/v3"
|
3489
|
+
#
|
3490
|
+
# # Create a client object. The client can be reused for multiple calls.
|
3491
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
3492
|
+
#
|
3493
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
3494
|
+
# request = Google::Cloud::Translate::V3::ImportDataRequest.new
|
3495
|
+
#
|
3496
|
+
# # Call the import_data method.
|
3497
|
+
# result = client.import_data request
|
3498
|
+
#
|
3499
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
3500
|
+
# # check the status of an operation, cancel it, or wait for results.
|
3501
|
+
# # Here is how to wait for a response.
|
3502
|
+
# result.wait_until_done! timeout: 60
|
3503
|
+
# if result.response?
|
3504
|
+
# p result.response
|
3505
|
+
# else
|
3506
|
+
# puts "No response received."
|
3507
|
+
# end
|
3508
|
+
#
|
3509
|
+
def import_data request, options = nil
|
3510
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
3511
|
+
|
3512
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest
|
3513
|
+
|
3514
|
+
# Converts hash and nil to an options object
|
3515
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
3516
|
+
|
3517
|
+
# Customize the options with defaults
|
3518
|
+
metadata = @config.rpcs.import_data.metadata.to_h
|
3519
|
+
|
3520
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
3521
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
3522
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
3523
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
3524
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
3525
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
3526
|
+
|
3527
|
+
header_params = {}
|
3528
|
+
if request.dataset
|
3529
|
+
header_params["dataset"] = request.dataset
|
3530
|
+
end
|
3531
|
+
|
3532
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
3533
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
3534
|
+
|
3535
|
+
options.apply_defaults timeout: @config.rpcs.import_data.timeout,
|
3536
|
+
metadata: metadata,
|
3537
|
+
retry_policy: @config.rpcs.import_data.retry_policy
|
3538
|
+
|
3539
|
+
options.apply_defaults timeout: @config.timeout,
|
3540
|
+
metadata: @config.metadata,
|
3541
|
+
retry_policy: @config.retry_policy
|
3542
|
+
|
3543
|
+
@translation_service_stub.call_rpc :import_data, request, options: options do |response, operation|
|
3544
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
3545
|
+
yield response, operation if block_given?
|
3546
|
+
return response
|
3547
|
+
end
|
3548
|
+
rescue ::GRPC::BadStatus => e
|
3549
|
+
raise ::Google::Cloud::Error.from_error(e)
|
3550
|
+
end
|
3551
|
+
|
3552
|
+
##
|
3553
|
+
# Exports dataset's data to the provided output location.
|
3554
|
+
#
|
3555
|
+
# @overload export_data(request, options = nil)
|
3556
|
+
# Pass arguments to `export_data` via a request object, either of type
|
3557
|
+
# {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash.
|
3558
|
+
#
|
3559
|
+
# @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash]
|
3560
|
+
# A request object representing the call parameters. Required. To specify no
|
3561
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
3562
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
3563
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
3564
|
+
#
|
3565
|
+
# @overload export_data(dataset: nil, output_config: nil)
|
3566
|
+
# Pass arguments to `export_data` via keyword arguments. Note that at
|
3567
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
3568
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1854
3569
|
#
|
1855
|
-
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1856
3570
|
# @param dataset [::String]
|
1857
|
-
# Required.
|
1858
|
-
# `projects/{project}/locations/{location-id}/
|
1859
|
-
# @param
|
1860
|
-
# Required. The
|
1861
|
-
# For now only one sentence per request is supported.
|
3571
|
+
# Required. Name of the dataset. In form of
|
3572
|
+
# `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
|
3573
|
+
# @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash]
|
3574
|
+
# Required. The config for the output content.
|
1862
3575
|
#
|
1863
3576
|
# @yield [response, operation] Access the result along with the RPC operation
|
1864
|
-
# @yieldparam response [::
|
3577
|
+
# @yieldparam response [::Gapic::Operation]
|
1865
3578
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1866
3579
|
#
|
1867
|
-
# @return [::
|
3580
|
+
# @return [::Gapic::Operation]
|
1868
3581
|
#
|
1869
3582
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1870
3583
|
#
|
@@ -1875,24 +3588,31 @@ module Google
|
|
1875
3588
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1876
3589
|
#
|
1877
3590
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1878
|
-
# request = Google::Cloud::Translate::V3::
|
3591
|
+
# request = Google::Cloud::Translate::V3::ExportDataRequest.new
|
1879
3592
|
#
|
1880
|
-
# # Call the
|
1881
|
-
# result = client.
|
3593
|
+
# # Call the export_data method.
|
3594
|
+
# result = client.export_data request
|
1882
3595
|
#
|
1883
|
-
# # The returned object is of type
|
1884
|
-
#
|
3596
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
3597
|
+
# # check the status of an operation, cancel it, or wait for results.
|
3598
|
+
# # Here is how to wait for a response.
|
3599
|
+
# result.wait_until_done! timeout: 60
|
3600
|
+
# if result.response?
|
3601
|
+
# p result.response
|
3602
|
+
# else
|
3603
|
+
# puts "No response received."
|
3604
|
+
# end
|
1885
3605
|
#
|
1886
|
-
def
|
3606
|
+
def export_data request, options = nil
|
1887
3607
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1888
3608
|
|
1889
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3609
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest
|
1890
3610
|
|
1891
3611
|
# Converts hash and nil to an options object
|
1892
3612
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1893
3613
|
|
1894
3614
|
# Customize the options with defaults
|
1895
|
-
metadata = @config.rpcs.
|
3615
|
+
metadata = @config.rpcs.export_data.metadata.to_h
|
1896
3616
|
|
1897
3617
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1898
3618
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1902,22 +3622,23 @@ module Google
|
|
1902
3622
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1903
3623
|
|
1904
3624
|
header_params = {}
|
1905
|
-
if request.
|
1906
|
-
header_params["
|
3625
|
+
if request.dataset
|
3626
|
+
header_params["dataset"] = request.dataset
|
1907
3627
|
end
|
1908
3628
|
|
1909
3629
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1910
3630
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1911
3631
|
|
1912
|
-
options.apply_defaults timeout: @config.rpcs.
|
3632
|
+
options.apply_defaults timeout: @config.rpcs.export_data.timeout,
|
1913
3633
|
metadata: metadata,
|
1914
|
-
retry_policy: @config.rpcs.
|
3634
|
+
retry_policy: @config.rpcs.export_data.retry_policy
|
1915
3635
|
|
1916
3636
|
options.apply_defaults timeout: @config.timeout,
|
1917
3637
|
metadata: @config.metadata,
|
1918
3638
|
retry_policy: @config.retry_policy
|
1919
3639
|
|
1920
|
-
@translation_service_stub.call_rpc :
|
3640
|
+
@translation_service_stub.call_rpc :export_data, request, options: options do |response, operation|
|
3641
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1921
3642
|
yield response, operation if block_given?
|
1922
3643
|
return response
|
1923
3644
|
end
|
@@ -1926,32 +3647,43 @@ module Google
|
|
1926
3647
|
end
|
1927
3648
|
|
1928
3649
|
##
|
1929
|
-
#
|
3650
|
+
# Lists sentence pairs in the dataset.
|
1930
3651
|
#
|
1931
|
-
# @overload
|
1932
|
-
# Pass arguments to `
|
1933
|
-
# {::Google::Cloud::Translate::V3::
|
3652
|
+
# @overload list_examples(request, options = nil)
|
3653
|
+
# Pass arguments to `list_examples` via a request object, either of type
|
3654
|
+
# {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash.
|
1934
3655
|
#
|
1935
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3656
|
+
# @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash]
|
1936
3657
|
# A request object representing the call parameters. Required. To specify no
|
1937
3658
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1938
3659
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1939
3660
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1940
3661
|
#
|
1941
|
-
# @overload
|
1942
|
-
# Pass arguments to `
|
3662
|
+
# @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
3663
|
+
# Pass arguments to `list_examples` via keyword arguments. Note that at
|
1943
3664
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1944
3665
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
1945
3666
|
#
|
1946
|
-
# @param
|
1947
|
-
# Required.
|
1948
|
-
# `projects/{project-number-or-id}/locations/{
|
3667
|
+
# @param parent [::String]
|
3668
|
+
# Required. Name of the parent dataset. In form of
|
3669
|
+
# `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
|
3670
|
+
# @param filter [::String]
|
3671
|
+
# Optional. An expression for filtering the examples that will be returned.
|
3672
|
+
# Example filter:
|
3673
|
+
# * `usage=TRAIN`
|
3674
|
+
# @param page_size [::Integer]
|
3675
|
+
# Optional. Requested page size. The server can return fewer results than
|
3676
|
+
# requested.
|
3677
|
+
# @param page_token [::String]
|
3678
|
+
# Optional. A token identifying a page of results for the server to return.
|
3679
|
+
# Typically obtained from next_page_token field in the response of a
|
3680
|
+
# ListExamples call.
|
1949
3681
|
#
|
1950
3682
|
# @yield [response, operation] Access the result along with the RPC operation
|
1951
|
-
# @yieldparam response [::Google::Cloud::Translate::V3::
|
3683
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>]
|
1952
3684
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1953
3685
|
#
|
1954
|
-
# @return [::Google::Cloud::Translate::V3::
|
3686
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Example>]
|
1955
3687
|
#
|
1956
3688
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1957
3689
|
#
|
@@ -1962,24 +3694,28 @@ module Google
|
|
1962
3694
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1963
3695
|
#
|
1964
3696
|
# # Create a request. To set request fields, pass in keyword arguments.
|
1965
|
-
# request = Google::Cloud::Translate::V3::
|
3697
|
+
# request = Google::Cloud::Translate::V3::ListExamplesRequest.new
|
1966
3698
|
#
|
1967
|
-
# # Call the
|
1968
|
-
# result = client.
|
3699
|
+
# # Call the list_examples method.
|
3700
|
+
# result = client.list_examples request
|
1969
3701
|
#
|
1970
|
-
# # The returned object is of type
|
1971
|
-
#
|
3702
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
3703
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
3704
|
+
# result.each do |item|
|
3705
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::Example.
|
3706
|
+
# p item
|
3707
|
+
# end
|
1972
3708
|
#
|
1973
|
-
def
|
3709
|
+
def list_examples request, options = nil
|
1974
3710
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1975
3711
|
|
1976
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3712
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest
|
1977
3713
|
|
1978
3714
|
# Converts hash and nil to an options object
|
1979
3715
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1980
3716
|
|
1981
3717
|
# Customize the options with defaults
|
1982
|
-
metadata = @config.rpcs.
|
3718
|
+
metadata = @config.rpcs.list_examples.metadata.to_h
|
1983
3719
|
|
1984
3720
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
1985
3721
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1989,22 +3725,23 @@ module Google
|
|
1989
3725
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1990
3726
|
|
1991
3727
|
header_params = {}
|
1992
|
-
if request.
|
1993
|
-
header_params["
|
3728
|
+
if request.parent
|
3729
|
+
header_params["parent"] = request.parent
|
1994
3730
|
end
|
1995
3731
|
|
1996
3732
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1997
3733
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1998
3734
|
|
1999
|
-
options.apply_defaults timeout: @config.rpcs.
|
3735
|
+
options.apply_defaults timeout: @config.rpcs.list_examples.timeout,
|
2000
3736
|
metadata: metadata,
|
2001
|
-
retry_policy: @config.rpcs.
|
3737
|
+
retry_policy: @config.rpcs.list_examples.retry_policy
|
2002
3738
|
|
2003
3739
|
options.apply_defaults timeout: @config.timeout,
|
2004
3740
|
metadata: @config.metadata,
|
2005
3741
|
retry_policy: @config.retry_policy
|
2006
3742
|
|
2007
|
-
@translation_service_stub.call_rpc :
|
3743
|
+
@translation_service_stub.call_rpc :list_examples, request, options: options do |response, operation|
|
3744
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_examples, request, response, operation, options
|
2008
3745
|
yield response, operation if block_given?
|
2009
3746
|
return response
|
2010
3747
|
end
|
@@ -2013,32 +3750,34 @@ module Google
|
|
2013
3750
|
end
|
2014
3751
|
|
2015
3752
|
##
|
2016
|
-
#
|
3753
|
+
# Creates a Model.
|
2017
3754
|
#
|
2018
|
-
# @overload
|
2019
|
-
# Pass arguments to `
|
2020
|
-
# {::Google::Cloud::Translate::V3::
|
3755
|
+
# @overload create_model(request, options = nil)
|
3756
|
+
# Pass arguments to `create_model` via a request object, either of type
|
3757
|
+
# {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash.
|
2021
3758
|
#
|
2022
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3759
|
+
# @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash]
|
2023
3760
|
# A request object representing the call parameters. Required. To specify no
|
2024
3761
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2025
3762
|
# @param options [::Gapic::CallOptions, ::Hash]
|
2026
3763
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2027
3764
|
#
|
2028
|
-
# @overload
|
2029
|
-
# Pass arguments to `
|
3765
|
+
# @overload create_model(parent: nil, model: nil)
|
3766
|
+
# Pass arguments to `create_model` via keyword arguments. Note that at
|
2030
3767
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
2031
3768
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
2032
3769
|
#
|
2033
|
-
# @param
|
2034
|
-
# Required. The
|
2035
|
-
# `projects/{project
|
3770
|
+
# @param parent [::String]
|
3771
|
+
# Required. The project name, in form of
|
3772
|
+
# `projects/{project}/locations/{location}`
|
3773
|
+
# @param model [::Google::Cloud::Translate::V3::Model, ::Hash]
|
3774
|
+
# Required. The Model to create.
|
2036
3775
|
#
|
2037
3776
|
# @yield [response, operation] Access the result along with the RPC operation
|
2038
|
-
# @yieldparam response [::
|
3777
|
+
# @yieldparam response [::Gapic::Operation]
|
2039
3778
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2040
3779
|
#
|
2041
|
-
# @return [::
|
3780
|
+
# @return [::Gapic::Operation]
|
2042
3781
|
#
|
2043
3782
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2044
3783
|
#
|
@@ -2049,24 +3788,31 @@ module Google
|
|
2049
3788
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2050
3789
|
#
|
2051
3790
|
# # Create a request. To set request fields, pass in keyword arguments.
|
2052
|
-
# request = Google::Cloud::Translate::V3::
|
3791
|
+
# request = Google::Cloud::Translate::V3::CreateModelRequest.new
|
2053
3792
|
#
|
2054
|
-
# # Call the
|
2055
|
-
# result = client.
|
3793
|
+
# # Call the create_model method.
|
3794
|
+
# result = client.create_model request
|
2056
3795
|
#
|
2057
|
-
# # The returned object is of type
|
2058
|
-
#
|
3796
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
3797
|
+
# # check the status of an operation, cancel it, or wait for results.
|
3798
|
+
# # Here is how to wait for a response.
|
3799
|
+
# result.wait_until_done! timeout: 60
|
3800
|
+
# if result.response?
|
3801
|
+
# p result.response
|
3802
|
+
# else
|
3803
|
+
# puts "No response received."
|
3804
|
+
# end
|
2059
3805
|
#
|
2060
|
-
def
|
3806
|
+
def create_model request, options = nil
|
2061
3807
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
2062
3808
|
|
2063
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3809
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest
|
2064
3810
|
|
2065
3811
|
# Converts hash and nil to an options object
|
2066
3812
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2067
3813
|
|
2068
3814
|
# Customize the options with defaults
|
2069
|
-
metadata = @config.rpcs.
|
3815
|
+
metadata = @config.rpcs.create_model.metadata.to_h
|
2070
3816
|
|
2071
3817
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2072
3818
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -2076,22 +3822,23 @@ module Google
|
|
2076
3822
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2077
3823
|
|
2078
3824
|
header_params = {}
|
2079
|
-
if request.
|
2080
|
-
header_params["
|
3825
|
+
if request.parent
|
3826
|
+
header_params["parent"] = request.parent
|
2081
3827
|
end
|
2082
3828
|
|
2083
3829
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2084
3830
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
2085
3831
|
|
2086
|
-
options.apply_defaults timeout: @config.rpcs.
|
3832
|
+
options.apply_defaults timeout: @config.rpcs.create_model.timeout,
|
2087
3833
|
metadata: metadata,
|
2088
|
-
retry_policy: @config.rpcs.
|
3834
|
+
retry_policy: @config.rpcs.create_model.retry_policy
|
2089
3835
|
|
2090
3836
|
options.apply_defaults timeout: @config.timeout,
|
2091
3837
|
metadata: @config.metadata,
|
2092
3838
|
retry_policy: @config.retry_policy
|
2093
3839
|
|
2094
|
-
@translation_service_stub.call_rpc :
|
3840
|
+
@translation_service_stub.call_rpc :create_model, request, options: options do |response, operation|
|
3841
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2095
3842
|
yield response, operation if block_given?
|
2096
3843
|
return response
|
2097
3844
|
end
|
@@ -2100,37 +3847,43 @@ module Google
|
|
2100
3847
|
end
|
2101
3848
|
|
2102
3849
|
##
|
2103
|
-
#
|
2104
|
-
# AdaptiveMtDataset.
|
3850
|
+
# Lists models.
|
2105
3851
|
#
|
2106
|
-
# @overload
|
2107
|
-
# Pass arguments to `
|
2108
|
-
# {::Google::Cloud::Translate::V3::
|
3852
|
+
# @overload list_models(request, options = nil)
|
3853
|
+
# Pass arguments to `list_models` via a request object, either of type
|
3854
|
+
# {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash.
|
2109
3855
|
#
|
2110
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3856
|
+
# @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash]
|
2111
3857
|
# A request object representing the call parameters. Required. To specify no
|
2112
3858
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2113
3859
|
# @param options [::Gapic::CallOptions, ::Hash]
|
2114
3860
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2115
3861
|
#
|
2116
|
-
# @overload
|
2117
|
-
# Pass arguments to `
|
3862
|
+
# @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
3863
|
+
# Pass arguments to `list_models` via keyword arguments. Note that at
|
2118
3864
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
2119
3865
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
2120
3866
|
#
|
2121
3867
|
# @param parent [::String]
|
2122
|
-
# Required.
|
2123
|
-
# `projects/{project-number-or-id}/locations/{
|
2124
|
-
# @param
|
2125
|
-
#
|
2126
|
-
#
|
2127
|
-
#
|
3868
|
+
# Required. Name of the parent project. In form of
|
3869
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
3870
|
+
# @param filter [::String]
|
3871
|
+
# Optional. An expression for filtering the models that will be returned.
|
3872
|
+
# Supported filter:
|
3873
|
+
# `dataset_id=${dataset_id}`
|
3874
|
+
# @param page_size [::Integer]
|
3875
|
+
# Optional. Requested page size. The server can return fewer results than
|
3876
|
+
# requested.
|
3877
|
+
# @param page_token [::String]
|
3878
|
+
# Optional. A token identifying a page of results for the server to return.
|
3879
|
+
# Typically obtained from next_page_token field in the response of a
|
3880
|
+
# ListModels call.
|
2128
3881
|
#
|
2129
3882
|
# @yield [response, operation] Access the result along with the RPC operation
|
2130
|
-
# @yieldparam response [::Google::Cloud::Translate::V3::
|
3883
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>]
|
2131
3884
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2132
3885
|
#
|
2133
|
-
# @return [::Google::Cloud::Translate::V3::
|
3886
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::Model>]
|
2134
3887
|
#
|
2135
3888
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2136
3889
|
#
|
@@ -2141,24 +3894,28 @@ module Google
|
|
2141
3894
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2142
3895
|
#
|
2143
3896
|
# # Create a request. To set request fields, pass in keyword arguments.
|
2144
|
-
# request = Google::Cloud::Translate::V3::
|
3897
|
+
# request = Google::Cloud::Translate::V3::ListModelsRequest.new
|
2145
3898
|
#
|
2146
|
-
# # Call the
|
2147
|
-
# result = client.
|
3899
|
+
# # Call the list_models method.
|
3900
|
+
# result = client.list_models request
|
2148
3901
|
#
|
2149
|
-
# # The returned object is of type
|
2150
|
-
#
|
3902
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
3903
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
3904
|
+
# result.each do |item|
|
3905
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::Model.
|
3906
|
+
# p item
|
3907
|
+
# end
|
2151
3908
|
#
|
2152
|
-
def
|
3909
|
+
def list_models request, options = nil
|
2153
3910
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
2154
3911
|
|
2155
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3912
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest
|
2156
3913
|
|
2157
3914
|
# Converts hash and nil to an options object
|
2158
3915
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2159
3916
|
|
2160
3917
|
# Customize the options with defaults
|
2161
|
-
metadata = @config.rpcs.
|
3918
|
+
metadata = @config.rpcs.list_models.metadata.to_h
|
2162
3919
|
|
2163
3920
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2164
3921
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -2175,15 +3932,16 @@ module Google
|
|
2175
3932
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2176
3933
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
2177
3934
|
|
2178
|
-
options.apply_defaults timeout: @config.rpcs.
|
3935
|
+
options.apply_defaults timeout: @config.rpcs.list_models.timeout,
|
2179
3936
|
metadata: metadata,
|
2180
|
-
retry_policy: @config.rpcs.
|
3937
|
+
retry_policy: @config.rpcs.list_models.retry_policy
|
2181
3938
|
|
2182
3939
|
options.apply_defaults timeout: @config.timeout,
|
2183
3940
|
metadata: @config.metadata,
|
2184
3941
|
retry_policy: @config.retry_policy
|
2185
3942
|
|
2186
|
-
@translation_service_stub.call_rpc :
|
3943
|
+
@translation_service_stub.call_rpc :list_models, request, options: options do |response, operation|
|
3944
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_models, request, response, operation, options
|
2187
3945
|
yield response, operation if block_given?
|
2188
3946
|
return response
|
2189
3947
|
end
|
@@ -2192,41 +3950,31 @@ module Google
|
|
2192
3950
|
end
|
2193
3951
|
|
2194
3952
|
##
|
2195
|
-
#
|
3953
|
+
# Gets a model.
|
2196
3954
|
#
|
2197
|
-
# @overload
|
2198
|
-
# Pass arguments to `
|
2199
|
-
# {::Google::Cloud::Translate::V3::
|
3955
|
+
# @overload get_model(request, options = nil)
|
3956
|
+
# Pass arguments to `get_model` via a request object, either of type
|
3957
|
+
# {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash.
|
2200
3958
|
#
|
2201
|
-
# @param request [::Google::Cloud::Translate::V3::
|
3959
|
+
# @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash]
|
2202
3960
|
# A request object representing the call parameters. Required. To specify no
|
2203
3961
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2204
3962
|
# @param options [::Gapic::CallOptions, ::Hash]
|
2205
3963
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2206
3964
|
#
|
2207
|
-
# @overload
|
2208
|
-
# Pass arguments to `
|
3965
|
+
# @overload get_model(name: nil)
|
3966
|
+
# Pass arguments to `get_model` via keyword arguments. Note that at
|
2209
3967
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
2210
3968
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
2211
3969
|
#
|
2212
|
-
# @param
|
2213
|
-
# Required. The resource name of the
|
2214
|
-
# MT files.
|
2215
|
-
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2216
|
-
# @param page_size [::Integer]
|
2217
|
-
# Optional.
|
2218
|
-
# @param page_token [::String]
|
2219
|
-
# Optional. A token identifying a page of results the server should return.
|
2220
|
-
# Typically, this is the value of
|
2221
|
-
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
2222
|
-
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
2223
|
-
# returned if `page_token`is empty or missing.
|
3970
|
+
# @param name [::String]
|
3971
|
+
# Required. The resource name of the model to retrieve.
|
2224
3972
|
#
|
2225
3973
|
# @yield [response, operation] Access the result along with the RPC operation
|
2226
|
-
# @yieldparam response [::
|
3974
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::Model]
|
2227
3975
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2228
3976
|
#
|
2229
|
-
# @return [::
|
3977
|
+
# @return [::Google::Cloud::Translate::V3::Model]
|
2230
3978
|
#
|
2231
3979
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2232
3980
|
#
|
@@ -2237,28 +3985,24 @@ module Google
|
|
2237
3985
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2238
3986
|
#
|
2239
3987
|
# # Create a request. To set request fields, pass in keyword arguments.
|
2240
|
-
# request = Google::Cloud::Translate::V3::
|
3988
|
+
# request = Google::Cloud::Translate::V3::GetModelRequest.new
|
2241
3989
|
#
|
2242
|
-
# # Call the
|
2243
|
-
# result = client.
|
3990
|
+
# # Call the get_model method.
|
3991
|
+
# result = client.get_model request
|
2244
3992
|
#
|
2245
|
-
# # The returned object is of type
|
2246
|
-
#
|
2247
|
-
# result.each do |item|
|
2248
|
-
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
2249
|
-
# p item
|
2250
|
-
# end
|
3993
|
+
# # The returned object is of type Google::Cloud::Translate::V3::Model.
|
3994
|
+
# p result
|
2251
3995
|
#
|
2252
|
-
def
|
3996
|
+
def get_model request, options = nil
|
2253
3997
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
2254
3998
|
|
2255
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
3999
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest
|
2256
4000
|
|
2257
4001
|
# Converts hash and nil to an options object
|
2258
4002
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2259
4003
|
|
2260
4004
|
# Customize the options with defaults
|
2261
|
-
metadata = @config.rpcs.
|
4005
|
+
metadata = @config.rpcs.get_model.metadata.to_h
|
2262
4006
|
|
2263
4007
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2264
4008
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -2268,23 +4012,22 @@ module Google
|
|
2268
4012
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2269
4013
|
|
2270
4014
|
header_params = {}
|
2271
|
-
if request.
|
2272
|
-
header_params["
|
4015
|
+
if request.name
|
4016
|
+
header_params["name"] = request.name
|
2273
4017
|
end
|
2274
4018
|
|
2275
4019
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2276
4020
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
2277
4021
|
|
2278
|
-
options.apply_defaults timeout: @config.rpcs.
|
4022
|
+
options.apply_defaults timeout: @config.rpcs.get_model.timeout,
|
2279
4023
|
metadata: metadata,
|
2280
|
-
retry_policy: @config.rpcs.
|
4024
|
+
retry_policy: @config.rpcs.get_model.retry_policy
|
2281
4025
|
|
2282
4026
|
options.apply_defaults timeout: @config.timeout,
|
2283
4027
|
metadata: @config.metadata,
|
2284
4028
|
retry_policy: @config.retry_policy
|
2285
4029
|
|
2286
|
-
@translation_service_stub.call_rpc :
|
2287
|
-
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options
|
4030
|
+
@translation_service_stub.call_rpc :get_model, request, options: options do |response, operation|
|
2288
4031
|
yield response, operation if block_given?
|
2289
4032
|
return response
|
2290
4033
|
end
|
@@ -2293,42 +4036,31 @@ module Google
|
|
2293
4036
|
end
|
2294
4037
|
|
2295
4038
|
##
|
2296
|
-
#
|
4039
|
+
# Deletes a model.
|
2297
4040
|
#
|
2298
|
-
# @overload
|
2299
|
-
# Pass arguments to `
|
2300
|
-
# {::Google::Cloud::Translate::V3::
|
4041
|
+
# @overload delete_model(request, options = nil)
|
4042
|
+
# Pass arguments to `delete_model` via a request object, either of type
|
4043
|
+
# {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash.
|
2301
4044
|
#
|
2302
|
-
# @param request [::Google::Cloud::Translate::V3::
|
4045
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash]
|
2303
4046
|
# A request object representing the call parameters. Required. To specify no
|
2304
4047
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2305
4048
|
# @param options [::Gapic::CallOptions, ::Hash]
|
2306
4049
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2307
4050
|
#
|
2308
|
-
# @overload
|
2309
|
-
# Pass arguments to `
|
4051
|
+
# @overload delete_model(name: nil)
|
4052
|
+
# Pass arguments to `delete_model` via keyword arguments. Note that at
|
2310
4053
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
2311
4054
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
2312
4055
|
#
|
2313
|
-
# @param
|
2314
|
-
# Required. The
|
2315
|
-
# MT files. The following format lists all sentences under a file.
|
2316
|
-
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2317
|
-
# The following format lists all sentences within a dataset.
|
2318
|
-
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2319
|
-
# @param page_size [::Integer]
|
2320
|
-
# @param page_token [::String]
|
2321
|
-
# A token identifying a page of results the server should return.
|
2322
|
-
# Typically, this is the value of
|
2323
|
-
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
2324
|
-
# previous call to `ListTranslationMemories` method. The first page is
|
2325
|
-
# returned if `page_token` is empty or missing.
|
4056
|
+
# @param name [::String]
|
4057
|
+
# Required. The name of the model to delete.
|
2326
4058
|
#
|
2327
4059
|
# @yield [response, operation] Access the result along with the RPC operation
|
2328
|
-
# @yieldparam response [::Gapic::
|
4060
|
+
# @yieldparam response [::Gapic::Operation]
|
2329
4061
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2330
4062
|
#
|
2331
|
-
# @return [::Gapic::
|
4063
|
+
# @return [::Gapic::Operation]
|
2332
4064
|
#
|
2333
4065
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2334
4066
|
#
|
@@ -2339,28 +4071,31 @@ module Google
|
|
2339
4071
|
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2340
4072
|
#
|
2341
4073
|
# # Create a request. To set request fields, pass in keyword arguments.
|
2342
|
-
# request = Google::Cloud::Translate::V3::
|
4074
|
+
# request = Google::Cloud::Translate::V3::DeleteModelRequest.new
|
2343
4075
|
#
|
2344
|
-
# # Call the
|
2345
|
-
# result = client.
|
4076
|
+
# # Call the delete_model method.
|
4077
|
+
# result = client.delete_model request
|
2346
4078
|
#
|
2347
|
-
# # The returned object is of type Gapic::
|
2348
|
-
# #
|
2349
|
-
#
|
2350
|
-
#
|
2351
|
-
#
|
4079
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
4080
|
+
# # check the status of an operation, cancel it, or wait for results.
|
4081
|
+
# # Here is how to wait for a response.
|
4082
|
+
# result.wait_until_done! timeout: 60
|
4083
|
+
# if result.response?
|
4084
|
+
# p result.response
|
4085
|
+
# else
|
4086
|
+
# puts "No response received."
|
2352
4087
|
# end
|
2353
4088
|
#
|
2354
|
-
def
|
4089
|
+
def delete_model request, options = nil
|
2355
4090
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
2356
4091
|
|
2357
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::
|
4092
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest
|
2358
4093
|
|
2359
4094
|
# Converts hash and nil to an options object
|
2360
4095
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2361
4096
|
|
2362
4097
|
# Customize the options with defaults
|
2363
|
-
metadata = @config.rpcs.
|
4098
|
+
metadata = @config.rpcs.delete_model.metadata.to_h
|
2364
4099
|
|
2365
4100
|
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
2366
4101
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -2370,23 +4105,23 @@ module Google
|
|
2370
4105
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2371
4106
|
|
2372
4107
|
header_params = {}
|
2373
|
-
if request.
|
2374
|
-
header_params["
|
4108
|
+
if request.name
|
4109
|
+
header_params["name"] = request.name
|
2375
4110
|
end
|
2376
4111
|
|
2377
4112
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2378
4113
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
2379
4114
|
|
2380
|
-
options.apply_defaults timeout: @config.rpcs.
|
4115
|
+
options.apply_defaults timeout: @config.rpcs.delete_model.timeout,
|
2381
4116
|
metadata: metadata,
|
2382
|
-
retry_policy: @config.rpcs.
|
4117
|
+
retry_policy: @config.rpcs.delete_model.retry_policy
|
2383
4118
|
|
2384
4119
|
options.apply_defaults timeout: @config.timeout,
|
2385
4120
|
metadata: @config.metadata,
|
2386
4121
|
retry_policy: @config.retry_policy
|
2387
4122
|
|
2388
|
-
@translation_service_stub.call_rpc :
|
2389
|
-
response = ::Gapic::
|
4123
|
+
@translation_service_stub.call_rpc :delete_model, request, options: options do |response, operation|
|
4124
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2390
4125
|
yield response, operation if block_given?
|
2391
4126
|
return response
|
2392
4127
|
end
|
@@ -2553,6 +4288,11 @@ module Google
|
|
2553
4288
|
#
|
2554
4289
|
attr_reader :translate_text
|
2555
4290
|
##
|
4291
|
+
# RPC-specific configuration for `romanize_text`
|
4292
|
+
# @return [::Gapic::Config::Method]
|
4293
|
+
#
|
4294
|
+
attr_reader :romanize_text
|
4295
|
+
##
|
2556
4296
|
# RPC-specific configuration for `detect_language`
|
2557
4297
|
# @return [::Gapic::Config::Method]
|
2558
4298
|
#
|
@@ -2583,6 +4323,11 @@ module Google
|
|
2583
4323
|
#
|
2584
4324
|
attr_reader :create_glossary
|
2585
4325
|
##
|
4326
|
+
# RPC-specific configuration for `update_glossary`
|
4327
|
+
# @return [::Gapic::Config::Method]
|
4328
|
+
#
|
4329
|
+
attr_reader :update_glossary
|
4330
|
+
##
|
2586
4331
|
# RPC-specific configuration for `list_glossaries`
|
2587
4332
|
# @return [::Gapic::Config::Method]
|
2588
4333
|
#
|
@@ -2598,6 +4343,51 @@ module Google
|
|
2598
4343
|
#
|
2599
4344
|
attr_reader :delete_glossary
|
2600
4345
|
##
|
4346
|
+
# RPC-specific configuration for `get_glossary_entry`
|
4347
|
+
# @return [::Gapic::Config::Method]
|
4348
|
+
#
|
4349
|
+
attr_reader :get_glossary_entry
|
4350
|
+
##
|
4351
|
+
# RPC-specific configuration for `list_glossary_entries`
|
4352
|
+
# @return [::Gapic::Config::Method]
|
4353
|
+
#
|
4354
|
+
attr_reader :list_glossary_entries
|
4355
|
+
##
|
4356
|
+
# RPC-specific configuration for `create_glossary_entry`
|
4357
|
+
# @return [::Gapic::Config::Method]
|
4358
|
+
#
|
4359
|
+
attr_reader :create_glossary_entry
|
4360
|
+
##
|
4361
|
+
# RPC-specific configuration for `update_glossary_entry`
|
4362
|
+
# @return [::Gapic::Config::Method]
|
4363
|
+
#
|
4364
|
+
attr_reader :update_glossary_entry
|
4365
|
+
##
|
4366
|
+
# RPC-specific configuration for `delete_glossary_entry`
|
4367
|
+
# @return [::Gapic::Config::Method]
|
4368
|
+
#
|
4369
|
+
attr_reader :delete_glossary_entry
|
4370
|
+
##
|
4371
|
+
# RPC-specific configuration for `create_dataset`
|
4372
|
+
# @return [::Gapic::Config::Method]
|
4373
|
+
#
|
4374
|
+
attr_reader :create_dataset
|
4375
|
+
##
|
4376
|
+
# RPC-specific configuration for `get_dataset`
|
4377
|
+
# @return [::Gapic::Config::Method]
|
4378
|
+
#
|
4379
|
+
attr_reader :get_dataset
|
4380
|
+
##
|
4381
|
+
# RPC-specific configuration for `list_datasets`
|
4382
|
+
# @return [::Gapic::Config::Method]
|
4383
|
+
#
|
4384
|
+
attr_reader :list_datasets
|
4385
|
+
##
|
4386
|
+
# RPC-specific configuration for `delete_dataset`
|
4387
|
+
# @return [::Gapic::Config::Method]
|
4388
|
+
#
|
4389
|
+
attr_reader :delete_dataset
|
4390
|
+
##
|
2601
4391
|
# RPC-specific configuration for `create_adaptive_mt_dataset`
|
2602
4392
|
# @return [::Gapic::Config::Method]
|
2603
4393
|
#
|
@@ -2647,11 +4437,48 @@ module Google
|
|
2647
4437
|
# @return [::Gapic::Config::Method]
|
2648
4438
|
#
|
2649
4439
|
attr_reader :list_adaptive_mt_sentences
|
4440
|
+
##
|
4441
|
+
# RPC-specific configuration for `import_data`
|
4442
|
+
# @return [::Gapic::Config::Method]
|
4443
|
+
#
|
4444
|
+
attr_reader :import_data
|
4445
|
+
##
|
4446
|
+
# RPC-specific configuration for `export_data`
|
4447
|
+
# @return [::Gapic::Config::Method]
|
4448
|
+
#
|
4449
|
+
attr_reader :export_data
|
4450
|
+
##
|
4451
|
+
# RPC-specific configuration for `list_examples`
|
4452
|
+
# @return [::Gapic::Config::Method]
|
4453
|
+
#
|
4454
|
+
attr_reader :list_examples
|
4455
|
+
##
|
4456
|
+
# RPC-specific configuration for `create_model`
|
4457
|
+
# @return [::Gapic::Config::Method]
|
4458
|
+
#
|
4459
|
+
attr_reader :create_model
|
4460
|
+
##
|
4461
|
+
# RPC-specific configuration for `list_models`
|
4462
|
+
# @return [::Gapic::Config::Method]
|
4463
|
+
#
|
4464
|
+
attr_reader :list_models
|
4465
|
+
##
|
4466
|
+
# RPC-specific configuration for `get_model`
|
4467
|
+
# @return [::Gapic::Config::Method]
|
4468
|
+
#
|
4469
|
+
attr_reader :get_model
|
4470
|
+
##
|
4471
|
+
# RPC-specific configuration for `delete_model`
|
4472
|
+
# @return [::Gapic::Config::Method]
|
4473
|
+
#
|
4474
|
+
attr_reader :delete_model
|
2650
4475
|
|
2651
4476
|
# @private
|
2652
4477
|
def initialize parent_rpcs = nil
|
2653
4478
|
translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text
|
2654
4479
|
@translate_text = ::Gapic::Config::Method.new translate_text_config
|
4480
|
+
romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text
|
4481
|
+
@romanize_text = ::Gapic::Config::Method.new romanize_text_config
|
2655
4482
|
detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language
|
2656
4483
|
@detect_language = ::Gapic::Config::Method.new detect_language_config
|
2657
4484
|
get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages
|
@@ -2664,12 +4491,32 @@ module Google
|
|
2664
4491
|
@batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config
|
2665
4492
|
create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary
|
2666
4493
|
@create_glossary = ::Gapic::Config::Method.new create_glossary_config
|
4494
|
+
update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary
|
4495
|
+
@update_glossary = ::Gapic::Config::Method.new update_glossary_config
|
2667
4496
|
list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries
|
2668
4497
|
@list_glossaries = ::Gapic::Config::Method.new list_glossaries_config
|
2669
4498
|
get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary
|
2670
4499
|
@get_glossary = ::Gapic::Config::Method.new get_glossary_config
|
2671
4500
|
delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
|
2672
4501
|
@delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
|
4502
|
+
get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry
|
4503
|
+
@get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config
|
4504
|
+
list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries
|
4505
|
+
@list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config
|
4506
|
+
create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry
|
4507
|
+
@create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config
|
4508
|
+
update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry
|
4509
|
+
@update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config
|
4510
|
+
delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry
|
4511
|
+
@delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config
|
4512
|
+
create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
|
4513
|
+
@create_dataset = ::Gapic::Config::Method.new create_dataset_config
|
4514
|
+
get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
|
4515
|
+
@get_dataset = ::Gapic::Config::Method.new get_dataset_config
|
4516
|
+
list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
|
4517
|
+
@list_datasets = ::Gapic::Config::Method.new list_datasets_config
|
4518
|
+
delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
|
4519
|
+
@delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
|
2673
4520
|
create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
|
2674
4521
|
@create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
|
2675
4522
|
delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
|
@@ -2690,6 +4537,20 @@ module Google
|
|
2690
4537
|
@list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
|
2691
4538
|
list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
|
2692
4539
|
@list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
|
4540
|
+
import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
|
4541
|
+
@import_data = ::Gapic::Config::Method.new import_data_config
|
4542
|
+
export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
|
4543
|
+
@export_data = ::Gapic::Config::Method.new export_data_config
|
4544
|
+
list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples
|
4545
|
+
@list_examples = ::Gapic::Config::Method.new list_examples_config
|
4546
|
+
create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
|
4547
|
+
@create_model = ::Gapic::Config::Method.new create_model_config
|
4548
|
+
list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
|
4549
|
+
@list_models = ::Gapic::Config::Method.new list_models_config
|
4550
|
+
get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
|
4551
|
+
@get_model = ::Gapic::Config::Method.new get_model_config
|
4552
|
+
delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
|
4553
|
+
@delete_model = ::Gapic::Config::Method.new delete_model_config
|
2693
4554
|
|
2694
4555
|
yield self if block_given?
|
2695
4556
|
end
|