google-cloud-translate-v3 0.9.0 → 0.10.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 +67 -0
- data/lib/google/cloud/translate/v3/common_pb.rb +46 -0
- data/lib/google/cloud/translate/v3/translation_service/client.rb +994 -3
- data/lib/google/cloud/translate/v3/translation_service/paths.rb +40 -0
- data/lib/google/cloud/translate/v3/translation_service/rest/client.rb +924 -3
- data/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +600 -0
- data/lib/google/cloud/translate/v3/translation_service_pb.rb +2 -1
- data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +22 -0
- data/lib/google/cloud/translate/v3/version.rb +1 -1
- data/proto_docs/google/api/client.rb +13 -0
- data/proto_docs/google/cloud/translate/v3/adaptive_mt.rb +327 -0
- data/proto_docs/google/cloud/translate/v3/common.rb +61 -0
- data/proto_docs/google/cloud/translate/v3/translation_service.rb +3 -3
- metadata +7 -3
@@ -901,9 +901,9 @@ module Google
|
|
901
901
|
# @param glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}]
|
902
902
|
# Optional. Glossaries to be applied. It's keyed by target language code.
|
903
903
|
# @param format_conversions [::Hash{::String => ::String}]
|
904
|
-
# Optional.
|
905
|
-
#
|
906
|
-
# translated documents.
|
904
|
+
# Optional. The file format conversion map that is applied to all input
|
905
|
+
# files. The map key is the original mime_type. The map value is the target
|
906
|
+
# mime_type of translated documents.
|
907
907
|
#
|
908
908
|
# Supported file format conversion includes:
|
909
909
|
# - `application/pdf` to
|
@@ -1354,6 +1354,857 @@ module Google
|
|
1354
1354
|
raise ::Google::Cloud::Error.from_error(e)
|
1355
1355
|
end
|
1356
1356
|
|
1357
|
+
##
|
1358
|
+
# Creates an Adaptive MT dataset.
|
1359
|
+
#
|
1360
|
+
# @overload create_adaptive_mt_dataset(request, options = nil)
|
1361
|
+
# Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
|
1362
|
+
# {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1363
|
+
#
|
1364
|
+
# @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
|
1365
|
+
# A request object representing the call parameters. Required. To specify no
|
1366
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1367
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1368
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1369
|
+
#
|
1370
|
+
# @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
|
1371
|
+
# Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
|
1372
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1373
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1374
|
+
#
|
1375
|
+
# @param parent [::String]
|
1376
|
+
# Required. Name of the parent project. In form of
|
1377
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
1378
|
+
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
1379
|
+
# Required. The AdaptiveMtDataset to be created.
|
1380
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1381
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1382
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1383
|
+
#
|
1384
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1385
|
+
#
|
1386
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1387
|
+
#
|
1388
|
+
# @example Basic example
|
1389
|
+
# require "google/cloud/translate/v3"
|
1390
|
+
#
|
1391
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1392
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1393
|
+
#
|
1394
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1395
|
+
# request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
|
1396
|
+
#
|
1397
|
+
# # Call the create_adaptive_mt_dataset method.
|
1398
|
+
# result = client.create_adaptive_mt_dataset request
|
1399
|
+
#
|
1400
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1401
|
+
# p result
|
1402
|
+
#
|
1403
|
+
def create_adaptive_mt_dataset request, options = nil
|
1404
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1405
|
+
|
1406
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
|
1407
|
+
|
1408
|
+
# Converts hash and nil to an options object
|
1409
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1410
|
+
|
1411
|
+
# Customize the options with defaults
|
1412
|
+
call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
|
1413
|
+
|
1414
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1415
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1416
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1417
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1418
|
+
transports_version_send: [:rest]
|
1419
|
+
|
1420
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1421
|
+
|
1422
|
+
options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
|
1423
|
+
metadata: call_metadata,
|
1424
|
+
retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
|
1425
|
+
|
1426
|
+
options.apply_defaults timeout: @config.timeout,
|
1427
|
+
metadata: @config.metadata,
|
1428
|
+
retry_policy: @config.retry_policy
|
1429
|
+
|
1430
|
+
@translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation|
|
1431
|
+
yield result, operation if block_given?
|
1432
|
+
return result
|
1433
|
+
end
|
1434
|
+
rescue ::Gapic::Rest::Error => e
|
1435
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1436
|
+
end
|
1437
|
+
|
1438
|
+
##
|
1439
|
+
# Deletes an Adaptive MT dataset, including all its entries and associated
|
1440
|
+
# metadata.
|
1441
|
+
#
|
1442
|
+
# @overload delete_adaptive_mt_dataset(request, options = nil)
|
1443
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
|
1444
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1445
|
+
#
|
1446
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
|
1447
|
+
# A request object representing the call parameters. Required. To specify no
|
1448
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1449
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1450
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1451
|
+
#
|
1452
|
+
# @overload delete_adaptive_mt_dataset(name: nil)
|
1453
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
|
1454
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1455
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1456
|
+
#
|
1457
|
+
# @param name [::String]
|
1458
|
+
# Required. Name of the dataset. In the form of
|
1459
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1460
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1461
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1462
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1463
|
+
#
|
1464
|
+
# @return [::Google::Protobuf::Empty]
|
1465
|
+
#
|
1466
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1467
|
+
#
|
1468
|
+
# @example Basic example
|
1469
|
+
# require "google/cloud/translate/v3"
|
1470
|
+
#
|
1471
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1472
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1473
|
+
#
|
1474
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1475
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
|
1476
|
+
#
|
1477
|
+
# # Call the delete_adaptive_mt_dataset method.
|
1478
|
+
# result = client.delete_adaptive_mt_dataset request
|
1479
|
+
#
|
1480
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1481
|
+
# p result
|
1482
|
+
#
|
1483
|
+
def delete_adaptive_mt_dataset request, options = nil
|
1484
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1485
|
+
|
1486
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
|
1487
|
+
|
1488
|
+
# Converts hash and nil to an options object
|
1489
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1490
|
+
|
1491
|
+
# Customize the options with defaults
|
1492
|
+
call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
|
1493
|
+
|
1494
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1495
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1496
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1497
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1498
|
+
transports_version_send: [:rest]
|
1499
|
+
|
1500
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1501
|
+
|
1502
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
|
1503
|
+
metadata: call_metadata,
|
1504
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
|
1505
|
+
|
1506
|
+
options.apply_defaults timeout: @config.timeout,
|
1507
|
+
metadata: @config.metadata,
|
1508
|
+
retry_policy: @config.retry_policy
|
1509
|
+
|
1510
|
+
@translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation|
|
1511
|
+
yield result, operation if block_given?
|
1512
|
+
return result
|
1513
|
+
end
|
1514
|
+
rescue ::Gapic::Rest::Error => e
|
1515
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1516
|
+
end
|
1517
|
+
|
1518
|
+
##
|
1519
|
+
# Gets the Adaptive MT dataset.
|
1520
|
+
#
|
1521
|
+
# @overload get_adaptive_mt_dataset(request, options = nil)
|
1522
|
+
# Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
|
1523
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1524
|
+
#
|
1525
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
|
1526
|
+
# A request object representing the call parameters. Required. To specify no
|
1527
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1528
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1529
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1530
|
+
#
|
1531
|
+
# @overload get_adaptive_mt_dataset(name: nil)
|
1532
|
+
# Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
|
1533
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1534
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1535
|
+
#
|
1536
|
+
# @param name [::String]
|
1537
|
+
# Required. Name of the dataset. In the form of
|
1538
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1539
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1540
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1541
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1542
|
+
#
|
1543
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1544
|
+
#
|
1545
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1546
|
+
#
|
1547
|
+
# @example Basic example
|
1548
|
+
# require "google/cloud/translate/v3"
|
1549
|
+
#
|
1550
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1551
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1552
|
+
#
|
1553
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1554
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
|
1555
|
+
#
|
1556
|
+
# # Call the get_adaptive_mt_dataset method.
|
1557
|
+
# result = client.get_adaptive_mt_dataset request
|
1558
|
+
#
|
1559
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1560
|
+
# p result
|
1561
|
+
#
|
1562
|
+
def get_adaptive_mt_dataset request, options = nil
|
1563
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1564
|
+
|
1565
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
|
1566
|
+
|
1567
|
+
# Converts hash and nil to an options object
|
1568
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1569
|
+
|
1570
|
+
# Customize the options with defaults
|
1571
|
+
call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
|
1572
|
+
|
1573
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1574
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1575
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1576
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1577
|
+
transports_version_send: [:rest]
|
1578
|
+
|
1579
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1580
|
+
|
1581
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
|
1582
|
+
metadata: call_metadata,
|
1583
|
+
retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
|
1584
|
+
|
1585
|
+
options.apply_defaults timeout: @config.timeout,
|
1586
|
+
metadata: @config.metadata,
|
1587
|
+
retry_policy: @config.retry_policy
|
1588
|
+
|
1589
|
+
@translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation|
|
1590
|
+
yield result, operation if block_given?
|
1591
|
+
return result
|
1592
|
+
end
|
1593
|
+
rescue ::Gapic::Rest::Error => e
|
1594
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
##
|
1598
|
+
# Lists all Adaptive MT datasets for which the caller has read permission.
|
1599
|
+
#
|
1600
|
+
# @overload list_adaptive_mt_datasets(request, options = nil)
|
1601
|
+
# Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
|
1602
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
|
1603
|
+
#
|
1604
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
|
1605
|
+
# A request object representing the call parameters. Required. To specify no
|
1606
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1607
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1608
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1609
|
+
#
|
1610
|
+
# @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
1611
|
+
# Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
|
1612
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1613
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1614
|
+
#
|
1615
|
+
# @param parent [::String]
|
1616
|
+
# Required. The resource name of the project from which to list the Adaptive
|
1617
|
+
# MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
|
1618
|
+
# @param page_size [::Integer]
|
1619
|
+
# Optional. Requested page size. The server may return fewer results than
|
1620
|
+
# requested. If unspecified, the server picks an appropriate default.
|
1621
|
+
# @param page_token [::String]
|
1622
|
+
# Optional. A token identifying a page of results the server should return.
|
1623
|
+
# Typically, this is the value of
|
1624
|
+
# ListAdaptiveMtDatasetsResponse.next_page_token returned from the
|
1625
|
+
# previous call to `ListAdaptiveMtDatasets` method. The first page is
|
1626
|
+
# returned if `page_token`is empty or missing.
|
1627
|
+
# @param filter [::String]
|
1628
|
+
# Optional. An expression for filtering the results of the request.
|
1629
|
+
# Filter is not supported yet.
|
1630
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1631
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1632
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1633
|
+
#
|
1634
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1635
|
+
#
|
1636
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1637
|
+
#
|
1638
|
+
# @example Basic example
|
1639
|
+
# require "google/cloud/translate/v3"
|
1640
|
+
#
|
1641
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1642
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1643
|
+
#
|
1644
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1645
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
|
1646
|
+
#
|
1647
|
+
# # Call the list_adaptive_mt_datasets method.
|
1648
|
+
# result = client.list_adaptive_mt_datasets request
|
1649
|
+
#
|
1650
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1651
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1652
|
+
# result.each do |item|
|
1653
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1654
|
+
# p item
|
1655
|
+
# end
|
1656
|
+
#
|
1657
|
+
def list_adaptive_mt_datasets request, options = nil
|
1658
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1659
|
+
|
1660
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
|
1661
|
+
|
1662
|
+
# Converts hash and nil to an options object
|
1663
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1664
|
+
|
1665
|
+
# Customize the options with defaults
|
1666
|
+
call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
|
1667
|
+
|
1668
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1669
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1670
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1671
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1672
|
+
transports_version_send: [:rest]
|
1673
|
+
|
1674
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1675
|
+
|
1676
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
|
1677
|
+
metadata: call_metadata,
|
1678
|
+
retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
|
1679
|
+
|
1680
|
+
options.apply_defaults timeout: @config.timeout,
|
1681
|
+
metadata: @config.metadata,
|
1682
|
+
retry_policy: @config.retry_policy
|
1683
|
+
|
1684
|
+
@translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation|
|
1685
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options
|
1686
|
+
yield result, operation if block_given?
|
1687
|
+
return result
|
1688
|
+
end
|
1689
|
+
rescue ::Gapic::Rest::Error => e
|
1690
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
##
|
1694
|
+
# Translate text using Adaptive MT.
|
1695
|
+
#
|
1696
|
+
# @overload adaptive_mt_translate(request, options = nil)
|
1697
|
+
# Pass arguments to `adaptive_mt_translate` via a request object, either of type
|
1698
|
+
# {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
|
1699
|
+
#
|
1700
|
+
# @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
|
1701
|
+
# A request object representing the call parameters. Required. To specify no
|
1702
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1703
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1704
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1705
|
+
#
|
1706
|
+
# @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil)
|
1707
|
+
# Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
|
1708
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1709
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1710
|
+
#
|
1711
|
+
# @param parent [::String]
|
1712
|
+
# Required. Location to make a regional call.
|
1713
|
+
#
|
1714
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1715
|
+
# @param dataset [::String]
|
1716
|
+
# Required. The resource name for the dataset to use for adaptive MT.
|
1717
|
+
# `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
|
1718
|
+
# @param content [::Array<::String>]
|
1719
|
+
# Required. The content of the input in string format.
|
1720
|
+
# For now only one sentence per request is supported.
|
1721
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1722
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1723
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1724
|
+
#
|
1725
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1726
|
+
#
|
1727
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1728
|
+
#
|
1729
|
+
# @example Basic example
|
1730
|
+
# require "google/cloud/translate/v3"
|
1731
|
+
#
|
1732
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1733
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1734
|
+
#
|
1735
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1736
|
+
# request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
|
1737
|
+
#
|
1738
|
+
# # Call the adaptive_mt_translate method.
|
1739
|
+
# result = client.adaptive_mt_translate request
|
1740
|
+
#
|
1741
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
|
1742
|
+
# p result
|
1743
|
+
#
|
1744
|
+
def adaptive_mt_translate request, options = nil
|
1745
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1746
|
+
|
1747
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
|
1748
|
+
|
1749
|
+
# Converts hash and nil to an options object
|
1750
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1751
|
+
|
1752
|
+
# Customize the options with defaults
|
1753
|
+
call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
|
1754
|
+
|
1755
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1756
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1757
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1758
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1759
|
+
transports_version_send: [:rest]
|
1760
|
+
|
1761
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1762
|
+
|
1763
|
+
options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
|
1764
|
+
metadata: call_metadata,
|
1765
|
+
retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
|
1766
|
+
|
1767
|
+
options.apply_defaults timeout: @config.timeout,
|
1768
|
+
metadata: @config.metadata,
|
1769
|
+
retry_policy: @config.retry_policy
|
1770
|
+
|
1771
|
+
@translation_service_stub.adaptive_mt_translate request, options do |result, operation|
|
1772
|
+
yield result, operation if block_given?
|
1773
|
+
return result
|
1774
|
+
end
|
1775
|
+
rescue ::Gapic::Rest::Error => e
|
1776
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
##
|
1780
|
+
# Gets and AdaptiveMtFile
|
1781
|
+
#
|
1782
|
+
# @overload get_adaptive_mt_file(request, options = nil)
|
1783
|
+
# Pass arguments to `get_adaptive_mt_file` via a request object, either of type
|
1784
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
|
1785
|
+
#
|
1786
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
|
1787
|
+
# A request object representing the call parameters. Required. To specify no
|
1788
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1789
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1790
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1791
|
+
#
|
1792
|
+
# @overload get_adaptive_mt_file(name: nil)
|
1793
|
+
# Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
|
1794
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1795
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1796
|
+
#
|
1797
|
+
# @param name [::String]
|
1798
|
+
# Required. The resource name of the file, in form of
|
1799
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1800
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1801
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1802
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1803
|
+
#
|
1804
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1805
|
+
#
|
1806
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1807
|
+
#
|
1808
|
+
# @example Basic example
|
1809
|
+
# require "google/cloud/translate/v3"
|
1810
|
+
#
|
1811
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1812
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1813
|
+
#
|
1814
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1815
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
|
1816
|
+
#
|
1817
|
+
# # Call the get_adaptive_mt_file method.
|
1818
|
+
# result = client.get_adaptive_mt_file request
|
1819
|
+
#
|
1820
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
|
1821
|
+
# p result
|
1822
|
+
#
|
1823
|
+
def get_adaptive_mt_file request, options = nil
|
1824
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1825
|
+
|
1826
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
|
1827
|
+
|
1828
|
+
# Converts hash and nil to an options object
|
1829
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1830
|
+
|
1831
|
+
# Customize the options with defaults
|
1832
|
+
call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
|
1833
|
+
|
1834
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1835
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1836
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1837
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1838
|
+
transports_version_send: [:rest]
|
1839
|
+
|
1840
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1841
|
+
|
1842
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
|
1843
|
+
metadata: call_metadata,
|
1844
|
+
retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
|
1845
|
+
|
1846
|
+
options.apply_defaults timeout: @config.timeout,
|
1847
|
+
metadata: @config.metadata,
|
1848
|
+
retry_policy: @config.retry_policy
|
1849
|
+
|
1850
|
+
@translation_service_stub.get_adaptive_mt_file request, options do |result, operation|
|
1851
|
+
yield result, operation if block_given?
|
1852
|
+
return result
|
1853
|
+
end
|
1854
|
+
rescue ::Gapic::Rest::Error => e
|
1855
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1856
|
+
end
|
1857
|
+
|
1858
|
+
##
|
1859
|
+
# Deletes an AdaptiveMtFile along with its sentences.
|
1860
|
+
#
|
1861
|
+
# @overload delete_adaptive_mt_file(request, options = nil)
|
1862
|
+
# Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
|
1863
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
|
1864
|
+
#
|
1865
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
|
1866
|
+
# A request object representing the call parameters. Required. To specify no
|
1867
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1868
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1869
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1870
|
+
#
|
1871
|
+
# @overload delete_adaptive_mt_file(name: nil)
|
1872
|
+
# Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
|
1873
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1874
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1875
|
+
#
|
1876
|
+
# @param name [::String]
|
1877
|
+
# Required. The resource name of the file to delete, in form of
|
1878
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1879
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1880
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1881
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1882
|
+
#
|
1883
|
+
# @return [::Google::Protobuf::Empty]
|
1884
|
+
#
|
1885
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1886
|
+
#
|
1887
|
+
# @example Basic example
|
1888
|
+
# require "google/cloud/translate/v3"
|
1889
|
+
#
|
1890
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1891
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1892
|
+
#
|
1893
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1894
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
|
1895
|
+
#
|
1896
|
+
# # Call the delete_adaptive_mt_file method.
|
1897
|
+
# result = client.delete_adaptive_mt_file request
|
1898
|
+
#
|
1899
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1900
|
+
# p result
|
1901
|
+
#
|
1902
|
+
def delete_adaptive_mt_file request, options = nil
|
1903
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1904
|
+
|
1905
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
|
1906
|
+
|
1907
|
+
# Converts hash and nil to an options object
|
1908
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1909
|
+
|
1910
|
+
# Customize the options with defaults
|
1911
|
+
call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
|
1912
|
+
|
1913
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1914
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1915
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1916
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1917
|
+
transports_version_send: [:rest]
|
1918
|
+
|
1919
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1920
|
+
|
1921
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
|
1922
|
+
metadata: call_metadata,
|
1923
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
|
1924
|
+
|
1925
|
+
options.apply_defaults timeout: @config.timeout,
|
1926
|
+
metadata: @config.metadata,
|
1927
|
+
retry_policy: @config.retry_policy
|
1928
|
+
|
1929
|
+
@translation_service_stub.delete_adaptive_mt_file request, options do |result, operation|
|
1930
|
+
yield result, operation if block_given?
|
1931
|
+
return result
|
1932
|
+
end
|
1933
|
+
rescue ::Gapic::Rest::Error => e
|
1934
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1935
|
+
end
|
1936
|
+
|
1937
|
+
##
|
1938
|
+
# Imports an AdaptiveMtFile and adds all of its sentences into the
|
1939
|
+
# AdaptiveMtDataset.
|
1940
|
+
#
|
1941
|
+
# @overload import_adaptive_mt_file(request, options = nil)
|
1942
|
+
# Pass arguments to `import_adaptive_mt_file` via a request object, either of type
|
1943
|
+
# {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
|
1944
|
+
#
|
1945
|
+
# @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
|
1946
|
+
# A request object representing the call parameters. Required. To specify no
|
1947
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1948
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1949
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1950
|
+
#
|
1951
|
+
# @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
|
1952
|
+
# Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
|
1953
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1954
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1955
|
+
#
|
1956
|
+
# @param parent [::String]
|
1957
|
+
# Required. The resource name of the file, in form of
|
1958
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
1959
|
+
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
1960
|
+
# Inline file source.
|
1961
|
+
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
1962
|
+
# Google Cloud Storage file source.
|
1963
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1964
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
1965
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1966
|
+
#
|
1967
|
+
# @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
1968
|
+
#
|
1969
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1970
|
+
#
|
1971
|
+
# @example Basic example
|
1972
|
+
# require "google/cloud/translate/v3"
|
1973
|
+
#
|
1974
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1975
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1976
|
+
#
|
1977
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1978
|
+
# request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
|
1979
|
+
#
|
1980
|
+
# # Call the import_adaptive_mt_file method.
|
1981
|
+
# result = client.import_adaptive_mt_file request
|
1982
|
+
#
|
1983
|
+
# # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
|
1984
|
+
# p result
|
1985
|
+
#
|
1986
|
+
def import_adaptive_mt_file request, options = nil
|
1987
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1988
|
+
|
1989
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
|
1990
|
+
|
1991
|
+
# Converts hash and nil to an options object
|
1992
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1993
|
+
|
1994
|
+
# Customize the options with defaults
|
1995
|
+
call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
|
1996
|
+
|
1997
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1998
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1999
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2000
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2001
|
+
transports_version_send: [:rest]
|
2002
|
+
|
2003
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2004
|
+
|
2005
|
+
options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
|
2006
|
+
metadata: call_metadata,
|
2007
|
+
retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
|
2008
|
+
|
2009
|
+
options.apply_defaults timeout: @config.timeout,
|
2010
|
+
metadata: @config.metadata,
|
2011
|
+
retry_policy: @config.retry_policy
|
2012
|
+
|
2013
|
+
@translation_service_stub.import_adaptive_mt_file request, options do |result, operation|
|
2014
|
+
yield result, operation if block_given?
|
2015
|
+
return result
|
2016
|
+
end
|
2017
|
+
rescue ::Gapic::Rest::Error => e
|
2018
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2019
|
+
end
|
2020
|
+
|
2021
|
+
##
|
2022
|
+
# Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
2023
|
+
#
|
2024
|
+
# @overload list_adaptive_mt_files(request, options = nil)
|
2025
|
+
# Pass arguments to `list_adaptive_mt_files` via a request object, either of type
|
2026
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
|
2027
|
+
#
|
2028
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
|
2029
|
+
# A request object representing the call parameters. Required. To specify no
|
2030
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2031
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2032
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2033
|
+
#
|
2034
|
+
# @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
|
2035
|
+
# Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
|
2036
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2037
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2038
|
+
#
|
2039
|
+
# @param parent [::String]
|
2040
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2041
|
+
# MT files.
|
2042
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2043
|
+
# @param page_size [::Integer]
|
2044
|
+
# Optional.
|
2045
|
+
# @param page_token [::String]
|
2046
|
+
# Optional. A token identifying a page of results the server should return.
|
2047
|
+
# Typically, this is the value of
|
2048
|
+
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
2049
|
+
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
2050
|
+
# returned if `page_token`is empty or missing.
|
2051
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2052
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2053
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2054
|
+
#
|
2055
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2056
|
+
#
|
2057
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2058
|
+
#
|
2059
|
+
# @example Basic example
|
2060
|
+
# require "google/cloud/translate/v3"
|
2061
|
+
#
|
2062
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2063
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
2064
|
+
#
|
2065
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2066
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
|
2067
|
+
#
|
2068
|
+
# # Call the list_adaptive_mt_files method.
|
2069
|
+
# result = client.list_adaptive_mt_files request
|
2070
|
+
#
|
2071
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2072
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2073
|
+
# result.each do |item|
|
2074
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
2075
|
+
# p item
|
2076
|
+
# end
|
2077
|
+
#
|
2078
|
+
def list_adaptive_mt_files request, options = nil
|
2079
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2080
|
+
|
2081
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
|
2082
|
+
|
2083
|
+
# Converts hash and nil to an options object
|
2084
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2085
|
+
|
2086
|
+
# Customize the options with defaults
|
2087
|
+
call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
|
2088
|
+
|
2089
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2090
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2091
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2092
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2093
|
+
transports_version_send: [:rest]
|
2094
|
+
|
2095
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2096
|
+
|
2097
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
|
2098
|
+
metadata: call_metadata,
|
2099
|
+
retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
|
2100
|
+
|
2101
|
+
options.apply_defaults timeout: @config.timeout,
|
2102
|
+
metadata: @config.metadata,
|
2103
|
+
retry_policy: @config.retry_policy
|
2104
|
+
|
2105
|
+
@translation_service_stub.list_adaptive_mt_files request, options do |result, operation|
|
2106
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options
|
2107
|
+
yield result, operation if block_given?
|
2108
|
+
return result
|
2109
|
+
end
|
2110
|
+
rescue ::Gapic::Rest::Error => e
|
2111
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2112
|
+
end
|
2113
|
+
|
2114
|
+
##
|
2115
|
+
# Lists all AdaptiveMtSentences under a given file/dataset.
|
2116
|
+
#
|
2117
|
+
# @overload list_adaptive_mt_sentences(request, options = nil)
|
2118
|
+
# Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
|
2119
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
|
2120
|
+
#
|
2121
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
|
2122
|
+
# A request object representing the call parameters. Required. To specify no
|
2123
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2124
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2125
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2126
|
+
#
|
2127
|
+
# @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
|
2128
|
+
# Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
|
2129
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2130
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2131
|
+
#
|
2132
|
+
# @param parent [::String]
|
2133
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2134
|
+
# MT files. The following format lists all sentences under a file.
|
2135
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2136
|
+
# The following format lists all sentences within a dataset.
|
2137
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2138
|
+
# @param page_size [::Integer]
|
2139
|
+
# @param page_token [::String]
|
2140
|
+
# A token identifying a page of results the server should return.
|
2141
|
+
# Typically, this is the value of
|
2142
|
+
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
2143
|
+
# previous call to `ListTranslationMemories` method. The first page is
|
2144
|
+
# returned if `page_token` is empty or missing.
|
2145
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2146
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2147
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2148
|
+
#
|
2149
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2150
|
+
#
|
2151
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2152
|
+
#
|
2153
|
+
# @example Basic example
|
2154
|
+
# require "google/cloud/translate/v3"
|
2155
|
+
#
|
2156
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2157
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
2158
|
+
#
|
2159
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2160
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
|
2161
|
+
#
|
2162
|
+
# # Call the list_adaptive_mt_sentences method.
|
2163
|
+
# result = client.list_adaptive_mt_sentences request
|
2164
|
+
#
|
2165
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2166
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2167
|
+
# result.each do |item|
|
2168
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
|
2169
|
+
# p item
|
2170
|
+
# end
|
2171
|
+
#
|
2172
|
+
def list_adaptive_mt_sentences request, options = nil
|
2173
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2174
|
+
|
2175
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
|
2176
|
+
|
2177
|
+
# Converts hash and nil to an options object
|
2178
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2179
|
+
|
2180
|
+
# Customize the options with defaults
|
2181
|
+
call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
|
2182
|
+
|
2183
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2184
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2185
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2186
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2187
|
+
transports_version_send: [:rest]
|
2188
|
+
|
2189
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2190
|
+
|
2191
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
|
2192
|
+
metadata: call_metadata,
|
2193
|
+
retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
|
2194
|
+
|
2195
|
+
options.apply_defaults timeout: @config.timeout,
|
2196
|
+
metadata: @config.metadata,
|
2197
|
+
retry_policy: @config.retry_policy
|
2198
|
+
|
2199
|
+
@translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation|
|
2200
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options
|
2201
|
+
yield result, operation if block_given?
|
2202
|
+
return result
|
2203
|
+
end
|
2204
|
+
rescue ::Gapic::Rest::Error => e
|
2205
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2206
|
+
end
|
2207
|
+
|
1357
2208
|
##
|
1358
2209
|
# Configuration class for the TranslationService REST API.
|
1359
2210
|
#
|
@@ -1529,6 +2380,56 @@ module Google
|
|
1529
2380
|
# @return [::Gapic::Config::Method]
|
1530
2381
|
#
|
1531
2382
|
attr_reader :delete_glossary
|
2383
|
+
##
|
2384
|
+
# RPC-specific configuration for `create_adaptive_mt_dataset`
|
2385
|
+
# @return [::Gapic::Config::Method]
|
2386
|
+
#
|
2387
|
+
attr_reader :create_adaptive_mt_dataset
|
2388
|
+
##
|
2389
|
+
# RPC-specific configuration for `delete_adaptive_mt_dataset`
|
2390
|
+
# @return [::Gapic::Config::Method]
|
2391
|
+
#
|
2392
|
+
attr_reader :delete_adaptive_mt_dataset
|
2393
|
+
##
|
2394
|
+
# RPC-specific configuration for `get_adaptive_mt_dataset`
|
2395
|
+
# @return [::Gapic::Config::Method]
|
2396
|
+
#
|
2397
|
+
attr_reader :get_adaptive_mt_dataset
|
2398
|
+
##
|
2399
|
+
# RPC-specific configuration for `list_adaptive_mt_datasets`
|
2400
|
+
# @return [::Gapic::Config::Method]
|
2401
|
+
#
|
2402
|
+
attr_reader :list_adaptive_mt_datasets
|
2403
|
+
##
|
2404
|
+
# RPC-specific configuration for `adaptive_mt_translate`
|
2405
|
+
# @return [::Gapic::Config::Method]
|
2406
|
+
#
|
2407
|
+
attr_reader :adaptive_mt_translate
|
2408
|
+
##
|
2409
|
+
# RPC-specific configuration for `get_adaptive_mt_file`
|
2410
|
+
# @return [::Gapic::Config::Method]
|
2411
|
+
#
|
2412
|
+
attr_reader :get_adaptive_mt_file
|
2413
|
+
##
|
2414
|
+
# RPC-specific configuration for `delete_adaptive_mt_file`
|
2415
|
+
# @return [::Gapic::Config::Method]
|
2416
|
+
#
|
2417
|
+
attr_reader :delete_adaptive_mt_file
|
2418
|
+
##
|
2419
|
+
# RPC-specific configuration for `import_adaptive_mt_file`
|
2420
|
+
# @return [::Gapic::Config::Method]
|
2421
|
+
#
|
2422
|
+
attr_reader :import_adaptive_mt_file
|
2423
|
+
##
|
2424
|
+
# RPC-specific configuration for `list_adaptive_mt_files`
|
2425
|
+
# @return [::Gapic::Config::Method]
|
2426
|
+
#
|
2427
|
+
attr_reader :list_adaptive_mt_files
|
2428
|
+
##
|
2429
|
+
# RPC-specific configuration for `list_adaptive_mt_sentences`
|
2430
|
+
# @return [::Gapic::Config::Method]
|
2431
|
+
#
|
2432
|
+
attr_reader :list_adaptive_mt_sentences
|
1532
2433
|
|
1533
2434
|
# @private
|
1534
2435
|
def initialize parent_rpcs = nil
|
@@ -1552,6 +2453,26 @@ module Google
|
|
1552
2453
|
@get_glossary = ::Gapic::Config::Method.new get_glossary_config
|
1553
2454
|
delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
|
1554
2455
|
@delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
|
2456
|
+
create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
|
2457
|
+
@create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
|
2458
|
+
delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
|
2459
|
+
@delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config
|
2460
|
+
get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset
|
2461
|
+
@get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config
|
2462
|
+
list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets
|
2463
|
+
@list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config
|
2464
|
+
adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate
|
2465
|
+
@adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config
|
2466
|
+
get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file
|
2467
|
+
@get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config
|
2468
|
+
delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file
|
2469
|
+
@delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config
|
2470
|
+
import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file
|
2471
|
+
@import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config
|
2472
|
+
list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files
|
2473
|
+
@list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
|
2474
|
+
list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
|
2475
|
+
@list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
|
1555
2476
|
|
1556
2477
|
yield self if block_given?
|
1557
2478
|
end
|