google-cloud-translate-v3 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -946,9 +946,9 @@ module Google
|
|
946
946
|
# @param glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}]
|
947
947
|
# Optional. Glossaries to be applied. It's keyed by target language code.
|
948
948
|
# @param format_conversions [::Hash{::String => ::String}]
|
949
|
-
# Optional.
|
950
|
-
#
|
951
|
-
# translated documents.
|
949
|
+
# Optional. The file format conversion map that is applied to all input
|
950
|
+
# files. The map key is the original mime_type. The map value is the target
|
951
|
+
# mime_type of translated documents.
|
952
952
|
#
|
953
953
|
# Supported file format conversion includes:
|
954
954
|
# - `application/pdf` to
|
@@ -1434,6 +1434,927 @@ module Google
|
|
1434
1434
|
raise ::Google::Cloud::Error.from_error(e)
|
1435
1435
|
end
|
1436
1436
|
|
1437
|
+
##
|
1438
|
+
# Creates an Adaptive MT dataset.
|
1439
|
+
#
|
1440
|
+
# @overload create_adaptive_mt_dataset(request, options = nil)
|
1441
|
+
# Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
|
1442
|
+
# {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1443
|
+
#
|
1444
|
+
# @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
|
1445
|
+
# A request object representing the call parameters. Required. To specify no
|
1446
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1447
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1448
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1449
|
+
#
|
1450
|
+
# @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
|
1451
|
+
# Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
|
1452
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1453
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1454
|
+
#
|
1455
|
+
# @param parent [::String]
|
1456
|
+
# Required. Name of the parent project. In form of
|
1457
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
1458
|
+
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
1459
|
+
# Required. The AdaptiveMtDataset to be created.
|
1460
|
+
#
|
1461
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1462
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1463
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1464
|
+
#
|
1465
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1466
|
+
#
|
1467
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1468
|
+
#
|
1469
|
+
# @example Basic example
|
1470
|
+
# require "google/cloud/translate/v3"
|
1471
|
+
#
|
1472
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1473
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1474
|
+
#
|
1475
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1476
|
+
# request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
|
1477
|
+
#
|
1478
|
+
# # Call the create_adaptive_mt_dataset method.
|
1479
|
+
# result = client.create_adaptive_mt_dataset request
|
1480
|
+
#
|
1481
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1482
|
+
# p result
|
1483
|
+
#
|
1484
|
+
def create_adaptive_mt_dataset request, options = nil
|
1485
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1486
|
+
|
1487
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
|
1488
|
+
|
1489
|
+
# Converts hash and nil to an options object
|
1490
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1491
|
+
|
1492
|
+
# Customize the options with defaults
|
1493
|
+
metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
|
1494
|
+
|
1495
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1496
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1497
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1498
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1499
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1500
|
+
|
1501
|
+
header_params = {}
|
1502
|
+
if request.parent
|
1503
|
+
header_params["parent"] = request.parent
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1507
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1508
|
+
|
1509
|
+
options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
|
1510
|
+
metadata: metadata,
|
1511
|
+
retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
|
1512
|
+
|
1513
|
+
options.apply_defaults timeout: @config.timeout,
|
1514
|
+
metadata: @config.metadata,
|
1515
|
+
retry_policy: @config.retry_policy
|
1516
|
+
|
1517
|
+
@translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation|
|
1518
|
+
yield response, operation if block_given?
|
1519
|
+
return response
|
1520
|
+
end
|
1521
|
+
rescue ::GRPC::BadStatus => e
|
1522
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1523
|
+
end
|
1524
|
+
|
1525
|
+
##
|
1526
|
+
# Deletes an Adaptive MT dataset, including all its entries and associated
|
1527
|
+
# metadata.
|
1528
|
+
#
|
1529
|
+
# @overload delete_adaptive_mt_dataset(request, options = nil)
|
1530
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
|
1531
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1532
|
+
#
|
1533
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
|
1534
|
+
# A request object representing the call parameters. Required. To specify no
|
1535
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1536
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1537
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1538
|
+
#
|
1539
|
+
# @overload delete_adaptive_mt_dataset(name: nil)
|
1540
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
|
1541
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1542
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1543
|
+
#
|
1544
|
+
# @param name [::String]
|
1545
|
+
# Required. Name of the dataset. In the form of
|
1546
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1547
|
+
#
|
1548
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1549
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
1550
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1551
|
+
#
|
1552
|
+
# @return [::Google::Protobuf::Empty]
|
1553
|
+
#
|
1554
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1555
|
+
#
|
1556
|
+
# @example Basic example
|
1557
|
+
# require "google/cloud/translate/v3"
|
1558
|
+
#
|
1559
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1560
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1561
|
+
#
|
1562
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1563
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
|
1564
|
+
#
|
1565
|
+
# # Call the delete_adaptive_mt_dataset method.
|
1566
|
+
# result = client.delete_adaptive_mt_dataset request
|
1567
|
+
#
|
1568
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1569
|
+
# p result
|
1570
|
+
#
|
1571
|
+
def delete_adaptive_mt_dataset request, options = nil
|
1572
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1573
|
+
|
1574
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
|
1575
|
+
|
1576
|
+
# Converts hash and nil to an options object
|
1577
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1578
|
+
|
1579
|
+
# Customize the options with defaults
|
1580
|
+
metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
|
1581
|
+
|
1582
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1583
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1584
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1585
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1586
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1587
|
+
|
1588
|
+
header_params = {}
|
1589
|
+
if request.name
|
1590
|
+
header_params["name"] = request.name
|
1591
|
+
end
|
1592
|
+
|
1593
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1594
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1595
|
+
|
1596
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
|
1597
|
+
metadata: metadata,
|
1598
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
|
1599
|
+
|
1600
|
+
options.apply_defaults timeout: @config.timeout,
|
1601
|
+
metadata: @config.metadata,
|
1602
|
+
retry_policy: @config.retry_policy
|
1603
|
+
|
1604
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation|
|
1605
|
+
yield response, operation if block_given?
|
1606
|
+
return response
|
1607
|
+
end
|
1608
|
+
rescue ::GRPC::BadStatus => e
|
1609
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
##
|
1613
|
+
# Gets the Adaptive MT dataset.
|
1614
|
+
#
|
1615
|
+
# @overload get_adaptive_mt_dataset(request, options = nil)
|
1616
|
+
# Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
|
1617
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1618
|
+
#
|
1619
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
|
1620
|
+
# A request object representing the call parameters. Required. To specify no
|
1621
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1622
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1623
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1624
|
+
#
|
1625
|
+
# @overload get_adaptive_mt_dataset(name: nil)
|
1626
|
+
# Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
|
1627
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1628
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1629
|
+
#
|
1630
|
+
# @param name [::String]
|
1631
|
+
# Required. Name of the dataset. In the form of
|
1632
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1633
|
+
#
|
1634
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1635
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1636
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1637
|
+
#
|
1638
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1639
|
+
#
|
1640
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1641
|
+
#
|
1642
|
+
# @example Basic example
|
1643
|
+
# require "google/cloud/translate/v3"
|
1644
|
+
#
|
1645
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1646
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1647
|
+
#
|
1648
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1649
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
|
1650
|
+
#
|
1651
|
+
# # Call the get_adaptive_mt_dataset method.
|
1652
|
+
# result = client.get_adaptive_mt_dataset request
|
1653
|
+
#
|
1654
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1655
|
+
# p result
|
1656
|
+
#
|
1657
|
+
def get_adaptive_mt_dataset 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::GetAdaptiveMtDatasetRequest
|
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
|
+
metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
|
1667
|
+
|
1668
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1669
|
+
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
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1673
|
+
|
1674
|
+
header_params = {}
|
1675
|
+
if request.name
|
1676
|
+
header_params["name"] = request.name
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1680
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1681
|
+
|
1682
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
|
1683
|
+
metadata: metadata,
|
1684
|
+
retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
|
1685
|
+
|
1686
|
+
options.apply_defaults timeout: @config.timeout,
|
1687
|
+
metadata: @config.metadata,
|
1688
|
+
retry_policy: @config.retry_policy
|
1689
|
+
|
1690
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation|
|
1691
|
+
yield response, operation if block_given?
|
1692
|
+
return response
|
1693
|
+
end
|
1694
|
+
rescue ::GRPC::BadStatus => e
|
1695
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1696
|
+
end
|
1697
|
+
|
1698
|
+
##
|
1699
|
+
# Lists all Adaptive MT datasets for which the caller has read permission.
|
1700
|
+
#
|
1701
|
+
# @overload list_adaptive_mt_datasets(request, options = nil)
|
1702
|
+
# Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
|
1703
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
|
1704
|
+
#
|
1705
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
|
1706
|
+
# A request object representing the call parameters. Required. To specify no
|
1707
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1708
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1709
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1710
|
+
#
|
1711
|
+
# @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
1712
|
+
# Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
|
1713
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1714
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1715
|
+
#
|
1716
|
+
# @param parent [::String]
|
1717
|
+
# Required. The resource name of the project from which to list the Adaptive
|
1718
|
+
# MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
|
1719
|
+
# @param page_size [::Integer]
|
1720
|
+
# Optional. Requested page size. The server may return fewer results than
|
1721
|
+
# requested. If unspecified, the server picks an appropriate default.
|
1722
|
+
# @param page_token [::String]
|
1723
|
+
# Optional. A token identifying a page of results the server should return.
|
1724
|
+
# Typically, this is the value of
|
1725
|
+
# ListAdaptiveMtDatasetsResponse.next_page_token returned from the
|
1726
|
+
# previous call to `ListAdaptiveMtDatasets` method. The first page is
|
1727
|
+
# returned if `page_token`is empty or missing.
|
1728
|
+
# @param filter [::String]
|
1729
|
+
# Optional. An expression for filtering the results of the request.
|
1730
|
+
# Filter is not supported yet.
|
1731
|
+
#
|
1732
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1733
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1734
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1735
|
+
#
|
1736
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1737
|
+
#
|
1738
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1739
|
+
#
|
1740
|
+
# @example Basic example
|
1741
|
+
# require "google/cloud/translate/v3"
|
1742
|
+
#
|
1743
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1744
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1745
|
+
#
|
1746
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1747
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
|
1748
|
+
#
|
1749
|
+
# # Call the list_adaptive_mt_datasets method.
|
1750
|
+
# result = client.list_adaptive_mt_datasets request
|
1751
|
+
#
|
1752
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1753
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1754
|
+
# result.each do |item|
|
1755
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1756
|
+
# p item
|
1757
|
+
# end
|
1758
|
+
#
|
1759
|
+
def list_adaptive_mt_datasets request, options = nil
|
1760
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1761
|
+
|
1762
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
|
1763
|
+
|
1764
|
+
# Converts hash and nil to an options object
|
1765
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1766
|
+
|
1767
|
+
# Customize the options with defaults
|
1768
|
+
metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
|
1769
|
+
|
1770
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1771
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1772
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1773
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1774
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1775
|
+
|
1776
|
+
header_params = {}
|
1777
|
+
if request.parent
|
1778
|
+
header_params["parent"] = request.parent
|
1779
|
+
end
|
1780
|
+
|
1781
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1782
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1783
|
+
|
1784
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
|
1785
|
+
metadata: metadata,
|
1786
|
+
retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
|
1787
|
+
|
1788
|
+
options.apply_defaults timeout: @config.timeout,
|
1789
|
+
metadata: @config.metadata,
|
1790
|
+
retry_policy: @config.retry_policy
|
1791
|
+
|
1792
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation|
|
1793
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options
|
1794
|
+
yield response, operation if block_given?
|
1795
|
+
return response
|
1796
|
+
end
|
1797
|
+
rescue ::GRPC::BadStatus => e
|
1798
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1799
|
+
end
|
1800
|
+
|
1801
|
+
##
|
1802
|
+
# Translate text using Adaptive MT.
|
1803
|
+
#
|
1804
|
+
# @overload adaptive_mt_translate(request, options = nil)
|
1805
|
+
# Pass arguments to `adaptive_mt_translate` via a request object, either of type
|
1806
|
+
# {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
|
1807
|
+
#
|
1808
|
+
# @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
|
1809
|
+
# A request object representing the call parameters. Required. To specify no
|
1810
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1811
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1812
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1813
|
+
#
|
1814
|
+
# @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil)
|
1815
|
+
# Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
|
1816
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1817
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1818
|
+
#
|
1819
|
+
# @param parent [::String]
|
1820
|
+
# Required. Location to make a regional call.
|
1821
|
+
#
|
1822
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1823
|
+
# @param dataset [::String]
|
1824
|
+
# Required. The resource name for the dataset to use for adaptive MT.
|
1825
|
+
# `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
|
1826
|
+
# @param content [::Array<::String>]
|
1827
|
+
# Required. The content of the input in string format.
|
1828
|
+
# For now only one sentence per request is supported.
|
1829
|
+
#
|
1830
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1831
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1832
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1833
|
+
#
|
1834
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1835
|
+
#
|
1836
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1837
|
+
#
|
1838
|
+
# @example Basic example
|
1839
|
+
# require "google/cloud/translate/v3"
|
1840
|
+
#
|
1841
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1842
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1843
|
+
#
|
1844
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1845
|
+
# request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
|
1846
|
+
#
|
1847
|
+
# # Call the adaptive_mt_translate method.
|
1848
|
+
# result = client.adaptive_mt_translate request
|
1849
|
+
#
|
1850
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
|
1851
|
+
# p result
|
1852
|
+
#
|
1853
|
+
def adaptive_mt_translate request, options = nil
|
1854
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1855
|
+
|
1856
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
|
1857
|
+
|
1858
|
+
# Converts hash and nil to an options object
|
1859
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1860
|
+
|
1861
|
+
# Customize the options with defaults
|
1862
|
+
metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
|
1863
|
+
|
1864
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1865
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1866
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1867
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1868
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1869
|
+
|
1870
|
+
header_params = {}
|
1871
|
+
if request.parent
|
1872
|
+
header_params["parent"] = request.parent
|
1873
|
+
end
|
1874
|
+
|
1875
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1876
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1877
|
+
|
1878
|
+
options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
|
1879
|
+
metadata: metadata,
|
1880
|
+
retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
|
1881
|
+
|
1882
|
+
options.apply_defaults timeout: @config.timeout,
|
1883
|
+
metadata: @config.metadata,
|
1884
|
+
retry_policy: @config.retry_policy
|
1885
|
+
|
1886
|
+
@translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation|
|
1887
|
+
yield response, operation if block_given?
|
1888
|
+
return response
|
1889
|
+
end
|
1890
|
+
rescue ::GRPC::BadStatus => e
|
1891
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
##
|
1895
|
+
# Gets and AdaptiveMtFile
|
1896
|
+
#
|
1897
|
+
# @overload get_adaptive_mt_file(request, options = nil)
|
1898
|
+
# Pass arguments to `get_adaptive_mt_file` via a request object, either of type
|
1899
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
|
1900
|
+
#
|
1901
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
|
1902
|
+
# A request object representing the call parameters. Required. To specify no
|
1903
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1904
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1905
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1906
|
+
#
|
1907
|
+
# @overload get_adaptive_mt_file(name: nil)
|
1908
|
+
# Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
|
1909
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1910
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1911
|
+
#
|
1912
|
+
# @param name [::String]
|
1913
|
+
# Required. The resource name of the file, in form of
|
1914
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1915
|
+
#
|
1916
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1917
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1918
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1919
|
+
#
|
1920
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1921
|
+
#
|
1922
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1923
|
+
#
|
1924
|
+
# @example Basic example
|
1925
|
+
# require "google/cloud/translate/v3"
|
1926
|
+
#
|
1927
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1928
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1929
|
+
#
|
1930
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1931
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
|
1932
|
+
#
|
1933
|
+
# # Call the get_adaptive_mt_file method.
|
1934
|
+
# result = client.get_adaptive_mt_file request
|
1935
|
+
#
|
1936
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
|
1937
|
+
# p result
|
1938
|
+
#
|
1939
|
+
def get_adaptive_mt_file request, options = nil
|
1940
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1941
|
+
|
1942
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
|
1943
|
+
|
1944
|
+
# Converts hash and nil to an options object
|
1945
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1946
|
+
|
1947
|
+
# Customize the options with defaults
|
1948
|
+
metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
|
1949
|
+
|
1950
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1951
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1952
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1953
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1954
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1955
|
+
|
1956
|
+
header_params = {}
|
1957
|
+
if request.name
|
1958
|
+
header_params["name"] = request.name
|
1959
|
+
end
|
1960
|
+
|
1961
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1962
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1963
|
+
|
1964
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
|
1965
|
+
metadata: metadata,
|
1966
|
+
retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
|
1967
|
+
|
1968
|
+
options.apply_defaults timeout: @config.timeout,
|
1969
|
+
metadata: @config.metadata,
|
1970
|
+
retry_policy: @config.retry_policy
|
1971
|
+
|
1972
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation|
|
1973
|
+
yield response, operation if block_given?
|
1974
|
+
return response
|
1975
|
+
end
|
1976
|
+
rescue ::GRPC::BadStatus => e
|
1977
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1978
|
+
end
|
1979
|
+
|
1980
|
+
##
|
1981
|
+
# Deletes an AdaptiveMtFile along with its sentences.
|
1982
|
+
#
|
1983
|
+
# @overload delete_adaptive_mt_file(request, options = nil)
|
1984
|
+
# Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
|
1985
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
|
1986
|
+
#
|
1987
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
|
1988
|
+
# A request object representing the call parameters. Required. To specify no
|
1989
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1990
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1991
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1992
|
+
#
|
1993
|
+
# @overload delete_adaptive_mt_file(name: nil)
|
1994
|
+
# Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
|
1995
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1996
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1997
|
+
#
|
1998
|
+
# @param name [::String]
|
1999
|
+
# Required. The resource name of the file to delete, in form of
|
2000
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2001
|
+
#
|
2002
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2003
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
2004
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2005
|
+
#
|
2006
|
+
# @return [::Google::Protobuf::Empty]
|
2007
|
+
#
|
2008
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2009
|
+
#
|
2010
|
+
# @example Basic example
|
2011
|
+
# require "google/cloud/translate/v3"
|
2012
|
+
#
|
2013
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2014
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2015
|
+
#
|
2016
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2017
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
|
2018
|
+
#
|
2019
|
+
# # Call the delete_adaptive_mt_file method.
|
2020
|
+
# result = client.delete_adaptive_mt_file request
|
2021
|
+
#
|
2022
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2023
|
+
# p result
|
2024
|
+
#
|
2025
|
+
def delete_adaptive_mt_file request, options = nil
|
2026
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2027
|
+
|
2028
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
|
2029
|
+
|
2030
|
+
# Converts hash and nil to an options object
|
2031
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2032
|
+
|
2033
|
+
# Customize the options with defaults
|
2034
|
+
metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
|
2035
|
+
|
2036
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2037
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2038
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2039
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2040
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2041
|
+
|
2042
|
+
header_params = {}
|
2043
|
+
if request.name
|
2044
|
+
header_params["name"] = request.name
|
2045
|
+
end
|
2046
|
+
|
2047
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2048
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2049
|
+
|
2050
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
|
2051
|
+
metadata: metadata,
|
2052
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
|
2053
|
+
|
2054
|
+
options.apply_defaults timeout: @config.timeout,
|
2055
|
+
metadata: @config.metadata,
|
2056
|
+
retry_policy: @config.retry_policy
|
2057
|
+
|
2058
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation|
|
2059
|
+
yield response, operation if block_given?
|
2060
|
+
return response
|
2061
|
+
end
|
2062
|
+
rescue ::GRPC::BadStatus => e
|
2063
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2064
|
+
end
|
2065
|
+
|
2066
|
+
##
|
2067
|
+
# Imports an AdaptiveMtFile and adds all of its sentences into the
|
2068
|
+
# AdaptiveMtDataset.
|
2069
|
+
#
|
2070
|
+
# @overload import_adaptive_mt_file(request, options = nil)
|
2071
|
+
# Pass arguments to `import_adaptive_mt_file` via a request object, either of type
|
2072
|
+
# {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
|
2073
|
+
#
|
2074
|
+
# @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
|
2075
|
+
# A request object representing the call parameters. Required. To specify no
|
2076
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2077
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2078
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2079
|
+
#
|
2080
|
+
# @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
|
2081
|
+
# Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
|
2082
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2083
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2084
|
+
#
|
2085
|
+
# @param parent [::String]
|
2086
|
+
# Required. The resource name of the file, in form of
|
2087
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
2088
|
+
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
2089
|
+
# Inline file source.
|
2090
|
+
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
2091
|
+
# Google Cloud Storage file source.
|
2092
|
+
#
|
2093
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2094
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
2095
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2096
|
+
#
|
2097
|
+
# @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
2098
|
+
#
|
2099
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2100
|
+
#
|
2101
|
+
# @example Basic example
|
2102
|
+
# require "google/cloud/translate/v3"
|
2103
|
+
#
|
2104
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2105
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2106
|
+
#
|
2107
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2108
|
+
# request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
|
2109
|
+
#
|
2110
|
+
# # Call the import_adaptive_mt_file method.
|
2111
|
+
# result = client.import_adaptive_mt_file request
|
2112
|
+
#
|
2113
|
+
# # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
|
2114
|
+
# p result
|
2115
|
+
#
|
2116
|
+
def import_adaptive_mt_file request, options = nil
|
2117
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2118
|
+
|
2119
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
|
2120
|
+
|
2121
|
+
# Converts hash and nil to an options object
|
2122
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2123
|
+
|
2124
|
+
# Customize the options with defaults
|
2125
|
+
metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
|
2126
|
+
|
2127
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2128
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2129
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2130
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2131
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2132
|
+
|
2133
|
+
header_params = {}
|
2134
|
+
if request.parent
|
2135
|
+
header_params["parent"] = request.parent
|
2136
|
+
end
|
2137
|
+
|
2138
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2139
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2140
|
+
|
2141
|
+
options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
|
2142
|
+
metadata: metadata,
|
2143
|
+
retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
|
2144
|
+
|
2145
|
+
options.apply_defaults timeout: @config.timeout,
|
2146
|
+
metadata: @config.metadata,
|
2147
|
+
retry_policy: @config.retry_policy
|
2148
|
+
|
2149
|
+
@translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation|
|
2150
|
+
yield response, operation if block_given?
|
2151
|
+
return response
|
2152
|
+
end
|
2153
|
+
rescue ::GRPC::BadStatus => e
|
2154
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2155
|
+
end
|
2156
|
+
|
2157
|
+
##
|
2158
|
+
# Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
2159
|
+
#
|
2160
|
+
# @overload list_adaptive_mt_files(request, options = nil)
|
2161
|
+
# Pass arguments to `list_adaptive_mt_files` via a request object, either of type
|
2162
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
|
2163
|
+
#
|
2164
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
|
2165
|
+
# A request object representing the call parameters. Required. To specify no
|
2166
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2167
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2168
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2169
|
+
#
|
2170
|
+
# @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
|
2171
|
+
# Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
|
2172
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2173
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2174
|
+
#
|
2175
|
+
# @param parent [::String]
|
2176
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2177
|
+
# MT files.
|
2178
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2179
|
+
# @param page_size [::Integer]
|
2180
|
+
# Optional.
|
2181
|
+
# @param page_token [::String]
|
2182
|
+
# Optional. A token identifying a page of results the server should return.
|
2183
|
+
# Typically, this is the value of
|
2184
|
+
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
2185
|
+
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
2186
|
+
# returned if `page_token`is empty or missing.
|
2187
|
+
#
|
2188
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2189
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2190
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2191
|
+
#
|
2192
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2193
|
+
#
|
2194
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2195
|
+
#
|
2196
|
+
# @example Basic example
|
2197
|
+
# require "google/cloud/translate/v3"
|
2198
|
+
#
|
2199
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2200
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2201
|
+
#
|
2202
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2203
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
|
2204
|
+
#
|
2205
|
+
# # Call the list_adaptive_mt_files method.
|
2206
|
+
# result = client.list_adaptive_mt_files request
|
2207
|
+
#
|
2208
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2209
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2210
|
+
# result.each do |item|
|
2211
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
2212
|
+
# p item
|
2213
|
+
# end
|
2214
|
+
#
|
2215
|
+
def list_adaptive_mt_files request, options = nil
|
2216
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2217
|
+
|
2218
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
|
2219
|
+
|
2220
|
+
# Converts hash and nil to an options object
|
2221
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2222
|
+
|
2223
|
+
# Customize the options with defaults
|
2224
|
+
metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
|
2225
|
+
|
2226
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2227
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2228
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2229
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2230
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2231
|
+
|
2232
|
+
header_params = {}
|
2233
|
+
if request.parent
|
2234
|
+
header_params["parent"] = request.parent
|
2235
|
+
end
|
2236
|
+
|
2237
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2238
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2239
|
+
|
2240
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
|
2241
|
+
metadata: metadata,
|
2242
|
+
retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
|
2243
|
+
|
2244
|
+
options.apply_defaults timeout: @config.timeout,
|
2245
|
+
metadata: @config.metadata,
|
2246
|
+
retry_policy: @config.retry_policy
|
2247
|
+
|
2248
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation|
|
2249
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options
|
2250
|
+
yield response, operation if block_given?
|
2251
|
+
return response
|
2252
|
+
end
|
2253
|
+
rescue ::GRPC::BadStatus => e
|
2254
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2255
|
+
end
|
2256
|
+
|
2257
|
+
##
|
2258
|
+
# Lists all AdaptiveMtSentences under a given file/dataset.
|
2259
|
+
#
|
2260
|
+
# @overload list_adaptive_mt_sentences(request, options = nil)
|
2261
|
+
# Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
|
2262
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
|
2263
|
+
#
|
2264
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
|
2265
|
+
# A request object representing the call parameters. Required. To specify no
|
2266
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2267
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2268
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2269
|
+
#
|
2270
|
+
# @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
|
2271
|
+
# Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
|
2272
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2273
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2274
|
+
#
|
2275
|
+
# @param parent [::String]
|
2276
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2277
|
+
# MT files. The following format lists all sentences under a file.
|
2278
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2279
|
+
# The following format lists all sentences within a dataset.
|
2280
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2281
|
+
# @param page_size [::Integer]
|
2282
|
+
# @param page_token [::String]
|
2283
|
+
# A token identifying a page of results the server should return.
|
2284
|
+
# Typically, this is the value of
|
2285
|
+
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
2286
|
+
# previous call to `ListTranslationMemories` method. The first page is
|
2287
|
+
# returned if `page_token` is empty or missing.
|
2288
|
+
#
|
2289
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2290
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2291
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2292
|
+
#
|
2293
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2294
|
+
#
|
2295
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2296
|
+
#
|
2297
|
+
# @example Basic example
|
2298
|
+
# require "google/cloud/translate/v3"
|
2299
|
+
#
|
2300
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2301
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2302
|
+
#
|
2303
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2304
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
|
2305
|
+
#
|
2306
|
+
# # Call the list_adaptive_mt_sentences method.
|
2307
|
+
# result = client.list_adaptive_mt_sentences request
|
2308
|
+
#
|
2309
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2310
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2311
|
+
# result.each do |item|
|
2312
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
|
2313
|
+
# p item
|
2314
|
+
# end
|
2315
|
+
#
|
2316
|
+
def list_adaptive_mt_sentences request, options = nil
|
2317
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2318
|
+
|
2319
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
|
2320
|
+
|
2321
|
+
# Converts hash and nil to an options object
|
2322
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2323
|
+
|
2324
|
+
# Customize the options with defaults
|
2325
|
+
metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
|
2326
|
+
|
2327
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2328
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2329
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2330
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2331
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2332
|
+
|
2333
|
+
header_params = {}
|
2334
|
+
if request.parent
|
2335
|
+
header_params["parent"] = request.parent
|
2336
|
+
end
|
2337
|
+
|
2338
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2339
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2340
|
+
|
2341
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
|
2342
|
+
metadata: metadata,
|
2343
|
+
retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
|
2344
|
+
|
2345
|
+
options.apply_defaults timeout: @config.timeout,
|
2346
|
+
metadata: @config.metadata,
|
2347
|
+
retry_policy: @config.retry_policy
|
2348
|
+
|
2349
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation|
|
2350
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options
|
2351
|
+
yield response, operation if block_given?
|
2352
|
+
return response
|
2353
|
+
end
|
2354
|
+
rescue ::GRPC::BadStatus => e
|
2355
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2356
|
+
end
|
2357
|
+
|
1437
2358
|
##
|
1438
2359
|
# Configuration class for the TranslationService API.
|
1439
2360
|
#
|
@@ -1629,6 +2550,56 @@ module Google
|
|
1629
2550
|
# @return [::Gapic::Config::Method]
|
1630
2551
|
#
|
1631
2552
|
attr_reader :delete_glossary
|
2553
|
+
##
|
2554
|
+
# RPC-specific configuration for `create_adaptive_mt_dataset`
|
2555
|
+
# @return [::Gapic::Config::Method]
|
2556
|
+
#
|
2557
|
+
attr_reader :create_adaptive_mt_dataset
|
2558
|
+
##
|
2559
|
+
# RPC-specific configuration for `delete_adaptive_mt_dataset`
|
2560
|
+
# @return [::Gapic::Config::Method]
|
2561
|
+
#
|
2562
|
+
attr_reader :delete_adaptive_mt_dataset
|
2563
|
+
##
|
2564
|
+
# RPC-specific configuration for `get_adaptive_mt_dataset`
|
2565
|
+
# @return [::Gapic::Config::Method]
|
2566
|
+
#
|
2567
|
+
attr_reader :get_adaptive_mt_dataset
|
2568
|
+
##
|
2569
|
+
# RPC-specific configuration for `list_adaptive_mt_datasets`
|
2570
|
+
# @return [::Gapic::Config::Method]
|
2571
|
+
#
|
2572
|
+
attr_reader :list_adaptive_mt_datasets
|
2573
|
+
##
|
2574
|
+
# RPC-specific configuration for `adaptive_mt_translate`
|
2575
|
+
# @return [::Gapic::Config::Method]
|
2576
|
+
#
|
2577
|
+
attr_reader :adaptive_mt_translate
|
2578
|
+
##
|
2579
|
+
# RPC-specific configuration for `get_adaptive_mt_file`
|
2580
|
+
# @return [::Gapic::Config::Method]
|
2581
|
+
#
|
2582
|
+
attr_reader :get_adaptive_mt_file
|
2583
|
+
##
|
2584
|
+
# RPC-specific configuration for `delete_adaptive_mt_file`
|
2585
|
+
# @return [::Gapic::Config::Method]
|
2586
|
+
#
|
2587
|
+
attr_reader :delete_adaptive_mt_file
|
2588
|
+
##
|
2589
|
+
# RPC-specific configuration for `import_adaptive_mt_file`
|
2590
|
+
# @return [::Gapic::Config::Method]
|
2591
|
+
#
|
2592
|
+
attr_reader :import_adaptive_mt_file
|
2593
|
+
##
|
2594
|
+
# RPC-specific configuration for `list_adaptive_mt_files`
|
2595
|
+
# @return [::Gapic::Config::Method]
|
2596
|
+
#
|
2597
|
+
attr_reader :list_adaptive_mt_files
|
2598
|
+
##
|
2599
|
+
# RPC-specific configuration for `list_adaptive_mt_sentences`
|
2600
|
+
# @return [::Gapic::Config::Method]
|
2601
|
+
#
|
2602
|
+
attr_reader :list_adaptive_mt_sentences
|
1632
2603
|
|
1633
2604
|
# @private
|
1634
2605
|
def initialize parent_rpcs = nil
|
@@ -1652,6 +2623,26 @@ module Google
|
|
1652
2623
|
@get_glossary = ::Gapic::Config::Method.new get_glossary_config
|
1653
2624
|
delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
|
1654
2625
|
@delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
|
2626
|
+
create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
|
2627
|
+
@create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
|
2628
|
+
delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
|
2629
|
+
@delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config
|
2630
|
+
get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset
|
2631
|
+
@get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config
|
2632
|
+
list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets
|
2633
|
+
@list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config
|
2634
|
+
adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate
|
2635
|
+
@adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config
|
2636
|
+
get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file
|
2637
|
+
@get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config
|
2638
|
+
delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file
|
2639
|
+
@delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config
|
2640
|
+
import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file
|
2641
|
+
@import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config
|
2642
|
+
list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files
|
2643
|
+
@list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
|
2644
|
+
list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
|
2645
|
+
@list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
|
1655
2646
|
|
1656
2647
|
yield self if block_given?
|
1657
2648
|
end
|