google-cloud-translate-v3 0.9.0 → 0.11.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/AUTHENTICATION.md +72 -101
- 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 +1163 -148
- data/lib/google/cloud/translate/v3/translation_service/operations.rb +28 -6
- data/lib/google/cloud/translate/v3/translation_service/paths.rb +40 -0
- data/lib/google/cloud/translate/v3/translation_service/rest/client.rb +1049 -101
- data/lib/google/cloud/translate/v3/translation_service/rest/operations.rb +33 -8
- data/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +614 -2
- 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 +14 -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 +9 -5
@@ -30,6 +30,9 @@ module Google
|
|
30
30
|
# Provides natural language translation operations.
|
31
31
|
#
|
32
32
|
class Client
|
33
|
+
# @private
|
34
|
+
DEFAULT_ENDPOINT_TEMPLATE = "translate.$UNIVERSE_DOMAIN$"
|
35
|
+
|
33
36
|
include Paths
|
34
37
|
|
35
38
|
# @private
|
@@ -122,6 +125,15 @@ module Google
|
|
122
125
|
@config
|
123
126
|
end
|
124
127
|
|
128
|
+
##
|
129
|
+
# The effective universe domain
|
130
|
+
#
|
131
|
+
# @return [String]
|
132
|
+
#
|
133
|
+
def universe_domain
|
134
|
+
@translation_service_stub.universe_domain
|
135
|
+
end
|
136
|
+
|
125
137
|
##
|
126
138
|
# Create a new TranslationService client object.
|
127
139
|
#
|
@@ -155,8 +167,9 @@ module Google
|
|
155
167
|
credentials = @config.credentials
|
156
168
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
157
169
|
# but only if the default endpoint does not have a region prefix.
|
158
|
-
enable_self_signed_jwt = @config.endpoint
|
159
|
-
|
170
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
171
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
172
|
+
!@config.endpoint.split(".").first.include?("-"))
|
160
173
|
credentials ||= Credentials.default scope: @config.scope,
|
161
174
|
enable_self_signed_jwt: enable_self_signed_jwt
|
162
175
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -169,12 +182,15 @@ module Google
|
|
169
182
|
config.credentials = credentials
|
170
183
|
config.quota_project = @quota_project_id
|
171
184
|
config.endpoint = @config.endpoint
|
185
|
+
config.universe_domain = @config.universe_domain
|
172
186
|
end
|
173
187
|
|
174
188
|
@translation_service_stub = ::Gapic::ServiceStub.new(
|
175
189
|
::Google::Cloud::Translate::V3::TranslationService::Stub,
|
176
|
-
credentials:
|
177
|
-
endpoint:
|
190
|
+
credentials: credentials,
|
191
|
+
endpoint: @config.endpoint,
|
192
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
193
|
+
universe_domain: @config.universe_domain,
|
178
194
|
channel_args: @config.channel_args,
|
179
195
|
interceptors: @config.interceptors,
|
180
196
|
channel_pool_config: @config.channel_pool
|
@@ -946,9 +962,9 @@ module Google
|
|
946
962
|
# @param glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}]
|
947
963
|
# Optional. Glossaries to be applied. It's keyed by target language code.
|
948
964
|
# @param format_conversions [::Hash{::String => ::String}]
|
949
|
-
# Optional.
|
950
|
-
#
|
951
|
-
# translated documents.
|
965
|
+
# Optional. The file format conversion map that is applied to all input
|
966
|
+
# files. The map key is the original mime_type. The map value is the target
|
967
|
+
# mime_type of translated documents.
|
952
968
|
#
|
953
969
|
# Supported file format conversion includes:
|
954
970
|
# - `application/pdf` to
|
@@ -1435,165 +1451,1094 @@ module Google
|
|
1435
1451
|
end
|
1436
1452
|
|
1437
1453
|
##
|
1438
|
-
#
|
1454
|
+
# Creates an Adaptive MT dataset.
|
1439
1455
|
#
|
1440
|
-
#
|
1441
|
-
#
|
1442
|
-
#
|
1443
|
-
# applied individually to specific RPCs. See
|
1444
|
-
# {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration::Rpcs}
|
1445
|
-
# for a list of RPCs that can be configured independently.
|
1456
|
+
# @overload create_adaptive_mt_dataset(request, options = nil)
|
1457
|
+
# Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
|
1458
|
+
# {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1446
1459
|
#
|
1447
|
-
#
|
1448
|
-
#
|
1460
|
+
# @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
|
1461
|
+
# A request object representing the call parameters. Required. To specify no
|
1462
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1463
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1464
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1449
1465
|
#
|
1450
|
-
# @
|
1466
|
+
# @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
|
1467
|
+
# Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
|
1468
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1469
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1451
1470
|
#
|
1452
|
-
#
|
1453
|
-
#
|
1454
|
-
#
|
1455
|
-
# ::Google::Cloud::Translate::V3::
|
1456
|
-
#
|
1457
|
-
# config.rpcs.translate_text.timeout = 20.0
|
1458
|
-
# end
|
1471
|
+
# @param parent [::String]
|
1472
|
+
# Required. Name of the parent project. In form of
|
1473
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
1474
|
+
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
1475
|
+
# Required. The AdaptiveMtDataset to be created.
|
1459
1476
|
#
|
1460
|
-
#
|
1461
|
-
#
|
1462
|
-
#
|
1463
|
-
# config.rpcs.translate_text.timeout = 20.0
|
1464
|
-
# end
|
1477
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1478
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1479
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1465
1480
|
#
|
1466
|
-
#
|
1467
|
-
# The hostname or hostname:port of the service endpoint.
|
1468
|
-
# Defaults to `"translate.googleapis.com"`.
|
1469
|
-
# @return [::String]
|
1470
|
-
# @!attribute [rw] credentials
|
1471
|
-
# Credentials to send with calls. You may provide any of the following types:
|
1472
|
-
# * (`String`) The path to a service account key file in JSON format
|
1473
|
-
# * (`Hash`) A service account key as a Hash
|
1474
|
-
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1475
|
-
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1476
|
-
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1477
|
-
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1478
|
-
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1479
|
-
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1480
|
-
# * (`nil`) indicating no credentials
|
1481
|
-
# @return [::Object]
|
1482
|
-
# @!attribute [rw] scope
|
1483
|
-
# The OAuth scopes
|
1484
|
-
# @return [::Array<::String>]
|
1485
|
-
# @!attribute [rw] lib_name
|
1486
|
-
# The library name as recorded in instrumentation and logging
|
1487
|
-
# @return [::String]
|
1488
|
-
# @!attribute [rw] lib_version
|
1489
|
-
# The library version as recorded in instrumentation and logging
|
1490
|
-
# @return [::String]
|
1491
|
-
# @!attribute [rw] channel_args
|
1492
|
-
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1493
|
-
# `GRPC::Core::Channel` object is provided as the credential.
|
1494
|
-
# @return [::Hash]
|
1495
|
-
# @!attribute [rw] interceptors
|
1496
|
-
# An array of interceptors that are run before calls are executed.
|
1497
|
-
# @return [::Array<::GRPC::ClientInterceptor>]
|
1498
|
-
# @!attribute [rw] timeout
|
1499
|
-
# The call timeout in seconds.
|
1500
|
-
# @return [::Numeric]
|
1501
|
-
# @!attribute [rw] metadata
|
1502
|
-
# Additional gRPC headers to be sent with the call.
|
1503
|
-
# @return [::Hash{::Symbol=>::String}]
|
1504
|
-
# @!attribute [rw] retry_policy
|
1505
|
-
# The retry policy. The value is a hash with the following keys:
|
1506
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1507
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1508
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1509
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1510
|
-
# trigger a retry.
|
1511
|
-
# @return [::Hash]
|
1512
|
-
# @!attribute [rw] quota_project
|
1513
|
-
# A separate project against which to charge quota.
|
1514
|
-
# @return [::String]
|
1481
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1515
1482
|
#
|
1516
|
-
|
1517
|
-
|
1483
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1484
|
+
#
|
1485
|
+
# @example Basic example
|
1486
|
+
# require "google/cloud/translate/v3"
|
1487
|
+
#
|
1488
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1489
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1490
|
+
#
|
1491
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1492
|
+
# request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
|
1493
|
+
#
|
1494
|
+
# # Call the create_adaptive_mt_dataset method.
|
1495
|
+
# result = client.create_adaptive_mt_dataset request
|
1496
|
+
#
|
1497
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1498
|
+
# p result
|
1499
|
+
#
|
1500
|
+
def create_adaptive_mt_dataset request, options = nil
|
1501
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1518
1502
|
|
1519
|
-
|
1503
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
|
1520
1504
|
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1505
|
+
# Converts hash and nil to an options object
|
1506
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1507
|
+
|
1508
|
+
# Customize the options with defaults
|
1509
|
+
metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
|
1510
|
+
|
1511
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1512
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1513
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1514
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1515
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1516
|
+
|
1517
|
+
header_params = {}
|
1518
|
+
if request.parent
|
1519
|
+
header_params["parent"] = request.parent
|
1526
1520
|
end
|
1527
|
-
config_attr :scope, nil, ::String, ::Array, nil
|
1528
|
-
config_attr :lib_name, nil, ::String, nil
|
1529
|
-
config_attr :lib_version, nil, ::String, nil
|
1530
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1531
|
-
config_attr :interceptors, nil, ::Array, nil
|
1532
|
-
config_attr :timeout, nil, ::Numeric, nil
|
1533
|
-
config_attr :metadata, nil, ::Hash, nil
|
1534
|
-
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1535
|
-
config_attr :quota_project, nil, ::String, nil
|
1536
1521
|
|
1537
|
-
#
|
1538
|
-
|
1539
|
-
@parent_config = parent_config unless parent_config.nil?
|
1522
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1523
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1540
1524
|
|
1541
|
-
|
1525
|
+
options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
|
1526
|
+
metadata: metadata,
|
1527
|
+
retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
|
1528
|
+
|
1529
|
+
options.apply_defaults timeout: @config.timeout,
|
1530
|
+
metadata: @config.metadata,
|
1531
|
+
retry_policy: @config.retry_policy
|
1532
|
+
|
1533
|
+
@translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation|
|
1534
|
+
yield response, operation if block_given?
|
1535
|
+
return response
|
1542
1536
|
end
|
1537
|
+
rescue ::GRPC::BadStatus => e
|
1538
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1539
|
+
end
|
1543
1540
|
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1541
|
+
##
|
1542
|
+
# Deletes an Adaptive MT dataset, including all its entries and associated
|
1543
|
+
# metadata.
|
1544
|
+
#
|
1545
|
+
# @overload delete_adaptive_mt_dataset(request, options = nil)
|
1546
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
|
1547
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1548
|
+
#
|
1549
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
|
1550
|
+
# A request object representing the call parameters. Required. To specify no
|
1551
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1552
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1553
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1554
|
+
#
|
1555
|
+
# @overload delete_adaptive_mt_dataset(name: nil)
|
1556
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
|
1557
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1558
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1559
|
+
#
|
1560
|
+
# @param name [::String]
|
1561
|
+
# Required. Name of the dataset. In the form of
|
1562
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1563
|
+
#
|
1564
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1565
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
1566
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1567
|
+
#
|
1568
|
+
# @return [::Google::Protobuf::Empty]
|
1569
|
+
#
|
1570
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1571
|
+
#
|
1572
|
+
# @example Basic example
|
1573
|
+
# require "google/cloud/translate/v3"
|
1574
|
+
#
|
1575
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1576
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1577
|
+
#
|
1578
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1579
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
|
1580
|
+
#
|
1581
|
+
# # Call the delete_adaptive_mt_dataset method.
|
1582
|
+
# result = client.delete_adaptive_mt_dataset request
|
1583
|
+
#
|
1584
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1585
|
+
# p result
|
1586
|
+
#
|
1587
|
+
def delete_adaptive_mt_dataset request, options = nil
|
1588
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1589
|
+
|
1590
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
|
1591
|
+
|
1592
|
+
# Converts hash and nil to an options object
|
1593
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1594
|
+
|
1595
|
+
# Customize the options with defaults
|
1596
|
+
metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
|
1597
|
+
|
1598
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1599
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1600
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1601
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1602
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1603
|
+
|
1604
|
+
header_params = {}
|
1605
|
+
if request.name
|
1606
|
+
header_params["name"] = request.name
|
1554
1607
|
end
|
1555
1608
|
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1609
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1610
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1611
|
+
|
1612
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
|
1613
|
+
metadata: metadata,
|
1614
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
|
1615
|
+
|
1616
|
+
options.apply_defaults timeout: @config.timeout,
|
1617
|
+
metadata: @config.metadata,
|
1618
|
+
retry_policy: @config.retry_policy
|
1619
|
+
|
1620
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation|
|
1621
|
+
yield response, operation if block_given?
|
1622
|
+
return response
|
1562
1623
|
end
|
1624
|
+
rescue ::GRPC::BadStatus => e
|
1625
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1626
|
+
end
|
1563
1627
|
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1628
|
+
##
|
1629
|
+
# Gets the Adaptive MT dataset.
|
1630
|
+
#
|
1631
|
+
# @overload get_adaptive_mt_dataset(request, options = nil)
|
1632
|
+
# Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
|
1633
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1634
|
+
#
|
1635
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
|
1636
|
+
# A request object representing the call parameters. Required. To specify no
|
1637
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1638
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1639
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1640
|
+
#
|
1641
|
+
# @overload get_adaptive_mt_dataset(name: nil)
|
1642
|
+
# Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
|
1643
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1644
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1645
|
+
#
|
1646
|
+
# @param name [::String]
|
1647
|
+
# Required. Name of the dataset. In the form of
|
1648
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1649
|
+
#
|
1650
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1651
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1652
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1653
|
+
#
|
1654
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1655
|
+
#
|
1656
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1657
|
+
#
|
1658
|
+
# @example Basic example
|
1659
|
+
# require "google/cloud/translate/v3"
|
1660
|
+
#
|
1661
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1662
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1663
|
+
#
|
1664
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1665
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
|
1666
|
+
#
|
1667
|
+
# # Call the get_adaptive_mt_dataset method.
|
1668
|
+
# result = client.get_adaptive_mt_dataset request
|
1669
|
+
#
|
1670
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1671
|
+
# p result
|
1672
|
+
#
|
1673
|
+
def get_adaptive_mt_dataset request, options = nil
|
1674
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1675
|
+
|
1676
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
|
1677
|
+
|
1678
|
+
# Converts hash and nil to an options object
|
1679
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1680
|
+
|
1681
|
+
# Customize the options with defaults
|
1682
|
+
metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
|
1683
|
+
|
1684
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1685
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1686
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1687
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1688
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1689
|
+
|
1690
|
+
header_params = {}
|
1691
|
+
if request.name
|
1692
|
+
header_params["name"] = request.name
|
1693
|
+
end
|
1694
|
+
|
1695
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1696
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1697
|
+
|
1698
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
|
1699
|
+
metadata: metadata,
|
1700
|
+
retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
|
1701
|
+
|
1702
|
+
options.apply_defaults timeout: @config.timeout,
|
1703
|
+
metadata: @config.metadata,
|
1704
|
+
retry_policy: @config.retry_policy
|
1705
|
+
|
1706
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation|
|
1707
|
+
yield response, operation if block_given?
|
1708
|
+
return response
|
1709
|
+
end
|
1710
|
+
rescue ::GRPC::BadStatus => e
|
1711
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1712
|
+
end
|
1713
|
+
|
1714
|
+
##
|
1715
|
+
# Lists all Adaptive MT datasets for which the caller has read permission.
|
1716
|
+
#
|
1717
|
+
# @overload list_adaptive_mt_datasets(request, options = nil)
|
1718
|
+
# Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
|
1719
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
|
1720
|
+
#
|
1721
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
|
1722
|
+
# A request object representing the call parameters. Required. To specify no
|
1723
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1724
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1725
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1726
|
+
#
|
1727
|
+
# @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
1728
|
+
# Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
|
1729
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1730
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1731
|
+
#
|
1732
|
+
# @param parent [::String]
|
1733
|
+
# Required. The resource name of the project from which to list the Adaptive
|
1734
|
+
# MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
|
1735
|
+
# @param page_size [::Integer]
|
1736
|
+
# Optional. Requested page size. The server may return fewer results than
|
1737
|
+
# requested. If unspecified, the server picks an appropriate default.
|
1738
|
+
# @param page_token [::String]
|
1739
|
+
# Optional. A token identifying a page of results the server should return.
|
1740
|
+
# Typically, this is the value of
|
1741
|
+
# ListAdaptiveMtDatasetsResponse.next_page_token returned from the
|
1742
|
+
# previous call to `ListAdaptiveMtDatasets` method. The first page is
|
1743
|
+
# returned if `page_token`is empty or missing.
|
1744
|
+
# @param filter [::String]
|
1745
|
+
# Optional. An expression for filtering the results of the request.
|
1746
|
+
# Filter is not supported yet.
|
1747
|
+
#
|
1748
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1749
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1750
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1751
|
+
#
|
1752
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1753
|
+
#
|
1754
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1755
|
+
#
|
1756
|
+
# @example Basic example
|
1757
|
+
# require "google/cloud/translate/v3"
|
1758
|
+
#
|
1759
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1760
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1761
|
+
#
|
1762
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1763
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
|
1764
|
+
#
|
1765
|
+
# # Call the list_adaptive_mt_datasets method.
|
1766
|
+
# result = client.list_adaptive_mt_datasets request
|
1767
|
+
#
|
1768
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1769
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1770
|
+
# result.each do |item|
|
1771
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1772
|
+
# p item
|
1773
|
+
# end
|
1774
|
+
#
|
1775
|
+
def list_adaptive_mt_datasets request, options = nil
|
1776
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1777
|
+
|
1778
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
|
1779
|
+
|
1780
|
+
# Converts hash and nil to an options object
|
1781
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1782
|
+
|
1783
|
+
# Customize the options with defaults
|
1784
|
+
metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
|
1785
|
+
|
1786
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1787
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1788
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1789
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1790
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1791
|
+
|
1792
|
+
header_params = {}
|
1793
|
+
if request.parent
|
1794
|
+
header_params["parent"] = request.parent
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1798
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1799
|
+
|
1800
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
|
1801
|
+
metadata: metadata,
|
1802
|
+
retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
|
1803
|
+
|
1804
|
+
options.apply_defaults timeout: @config.timeout,
|
1805
|
+
metadata: @config.metadata,
|
1806
|
+
retry_policy: @config.retry_policy
|
1807
|
+
|
1808
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation|
|
1809
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options
|
1810
|
+
yield response, operation if block_given?
|
1811
|
+
return response
|
1812
|
+
end
|
1813
|
+
rescue ::GRPC::BadStatus => e
|
1814
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
##
|
1818
|
+
# Translate text using Adaptive MT.
|
1819
|
+
#
|
1820
|
+
# @overload adaptive_mt_translate(request, options = nil)
|
1821
|
+
# Pass arguments to `adaptive_mt_translate` via a request object, either of type
|
1822
|
+
# {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
|
1823
|
+
#
|
1824
|
+
# @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
|
1825
|
+
# A request object representing the call parameters. Required. To specify no
|
1826
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1827
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1828
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1829
|
+
#
|
1830
|
+
# @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil)
|
1831
|
+
# Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
|
1832
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1833
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1834
|
+
#
|
1835
|
+
# @param parent [::String]
|
1836
|
+
# Required. Location to make a regional call.
|
1837
|
+
#
|
1838
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1839
|
+
# @param dataset [::String]
|
1840
|
+
# Required. The resource name for the dataset to use for adaptive MT.
|
1841
|
+
# `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
|
1842
|
+
# @param content [::Array<::String>]
|
1843
|
+
# Required. The content of the input in string format.
|
1844
|
+
# For now only one sentence per request is supported.
|
1845
|
+
#
|
1846
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1847
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1848
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1849
|
+
#
|
1850
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1851
|
+
#
|
1852
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1853
|
+
#
|
1854
|
+
# @example Basic example
|
1855
|
+
# require "google/cloud/translate/v3"
|
1856
|
+
#
|
1857
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1858
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1859
|
+
#
|
1860
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1861
|
+
# request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
|
1862
|
+
#
|
1863
|
+
# # Call the adaptive_mt_translate method.
|
1864
|
+
# result = client.adaptive_mt_translate request
|
1865
|
+
#
|
1866
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
|
1867
|
+
# p result
|
1868
|
+
#
|
1869
|
+
def adaptive_mt_translate request, options = nil
|
1870
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1871
|
+
|
1872
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
|
1873
|
+
|
1874
|
+
# Converts hash and nil to an options object
|
1875
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1876
|
+
|
1877
|
+
# Customize the options with defaults
|
1878
|
+
metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
|
1879
|
+
|
1880
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1881
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1882
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1883
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1884
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1885
|
+
|
1886
|
+
header_params = {}
|
1887
|
+
if request.parent
|
1888
|
+
header_params["parent"] = request.parent
|
1889
|
+
end
|
1890
|
+
|
1891
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1892
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1893
|
+
|
1894
|
+
options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
|
1895
|
+
metadata: metadata,
|
1896
|
+
retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
|
1897
|
+
|
1898
|
+
options.apply_defaults timeout: @config.timeout,
|
1899
|
+
metadata: @config.metadata,
|
1900
|
+
retry_policy: @config.retry_policy
|
1901
|
+
|
1902
|
+
@translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation|
|
1903
|
+
yield response, operation if block_given?
|
1904
|
+
return response
|
1905
|
+
end
|
1906
|
+
rescue ::GRPC::BadStatus => e
|
1907
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1908
|
+
end
|
1909
|
+
|
1910
|
+
##
|
1911
|
+
# Gets and AdaptiveMtFile
|
1912
|
+
#
|
1913
|
+
# @overload get_adaptive_mt_file(request, options = nil)
|
1914
|
+
# Pass arguments to `get_adaptive_mt_file` via a request object, either of type
|
1915
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
|
1916
|
+
#
|
1917
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
|
1918
|
+
# A request object representing the call parameters. Required. To specify no
|
1919
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1920
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1921
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1922
|
+
#
|
1923
|
+
# @overload get_adaptive_mt_file(name: nil)
|
1924
|
+
# Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
|
1925
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1926
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1927
|
+
#
|
1928
|
+
# @param name [::String]
|
1929
|
+
# Required. The resource name of the file, in form of
|
1930
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1931
|
+
#
|
1932
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1933
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1934
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1935
|
+
#
|
1936
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1937
|
+
#
|
1938
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1939
|
+
#
|
1940
|
+
# @example Basic example
|
1941
|
+
# require "google/cloud/translate/v3"
|
1942
|
+
#
|
1943
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1944
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
1945
|
+
#
|
1946
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1947
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
|
1948
|
+
#
|
1949
|
+
# # Call the get_adaptive_mt_file method.
|
1950
|
+
# result = client.get_adaptive_mt_file request
|
1951
|
+
#
|
1952
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
|
1953
|
+
# p result
|
1954
|
+
#
|
1955
|
+
def get_adaptive_mt_file request, options = nil
|
1956
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1957
|
+
|
1958
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
|
1959
|
+
|
1960
|
+
# Converts hash and nil to an options object
|
1961
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1962
|
+
|
1963
|
+
# Customize the options with defaults
|
1964
|
+
metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
|
1965
|
+
|
1966
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1967
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1968
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1969
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
1970
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1971
|
+
|
1972
|
+
header_params = {}
|
1973
|
+
if request.name
|
1974
|
+
header_params["name"] = request.name
|
1975
|
+
end
|
1976
|
+
|
1977
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1978
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1979
|
+
|
1980
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
|
1981
|
+
metadata: metadata,
|
1982
|
+
retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
|
1983
|
+
|
1984
|
+
options.apply_defaults timeout: @config.timeout,
|
1985
|
+
metadata: @config.metadata,
|
1986
|
+
retry_policy: @config.retry_policy
|
1987
|
+
|
1988
|
+
@translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation|
|
1989
|
+
yield response, operation if block_given?
|
1990
|
+
return response
|
1991
|
+
end
|
1992
|
+
rescue ::GRPC::BadStatus => e
|
1993
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1994
|
+
end
|
1995
|
+
|
1996
|
+
##
|
1997
|
+
# Deletes an AdaptiveMtFile along with its sentences.
|
1998
|
+
#
|
1999
|
+
# @overload delete_adaptive_mt_file(request, options = nil)
|
2000
|
+
# Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
|
2001
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
|
2002
|
+
#
|
2003
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
|
2004
|
+
# A request object representing the call parameters. Required. To specify no
|
2005
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2006
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2007
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2008
|
+
#
|
2009
|
+
# @overload delete_adaptive_mt_file(name: nil)
|
2010
|
+
# Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
|
2011
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2012
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2013
|
+
#
|
2014
|
+
# @param name [::String]
|
2015
|
+
# Required. The resource name of the file to delete, in form of
|
2016
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2017
|
+
#
|
2018
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2019
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
2020
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2021
|
+
#
|
2022
|
+
# @return [::Google::Protobuf::Empty]
|
2023
|
+
#
|
2024
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2025
|
+
#
|
2026
|
+
# @example Basic example
|
2027
|
+
# require "google/cloud/translate/v3"
|
2028
|
+
#
|
2029
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2030
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2031
|
+
#
|
2032
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2033
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
|
2034
|
+
#
|
2035
|
+
# # Call the delete_adaptive_mt_file method.
|
2036
|
+
# result = client.delete_adaptive_mt_file request
|
2037
|
+
#
|
2038
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
2039
|
+
# p result
|
2040
|
+
#
|
2041
|
+
def delete_adaptive_mt_file request, options = nil
|
2042
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2043
|
+
|
2044
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
|
2045
|
+
|
2046
|
+
# Converts hash and nil to an options object
|
2047
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2048
|
+
|
2049
|
+
# Customize the options with defaults
|
2050
|
+
metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
|
2051
|
+
|
2052
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2053
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2054
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2055
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2056
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2057
|
+
|
2058
|
+
header_params = {}
|
2059
|
+
if request.name
|
2060
|
+
header_params["name"] = request.name
|
2061
|
+
end
|
2062
|
+
|
2063
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2064
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2065
|
+
|
2066
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
|
2067
|
+
metadata: metadata,
|
2068
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
|
2069
|
+
|
2070
|
+
options.apply_defaults timeout: @config.timeout,
|
2071
|
+
metadata: @config.metadata,
|
2072
|
+
retry_policy: @config.retry_policy
|
2073
|
+
|
2074
|
+
@translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation|
|
2075
|
+
yield response, operation if block_given?
|
2076
|
+
return response
|
2077
|
+
end
|
2078
|
+
rescue ::GRPC::BadStatus => e
|
2079
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
##
|
2083
|
+
# Imports an AdaptiveMtFile and adds all of its sentences into the
|
2084
|
+
# AdaptiveMtDataset.
|
2085
|
+
#
|
2086
|
+
# @overload import_adaptive_mt_file(request, options = nil)
|
2087
|
+
# Pass arguments to `import_adaptive_mt_file` via a request object, either of type
|
2088
|
+
# {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
|
2089
|
+
#
|
2090
|
+
# @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
|
2091
|
+
# A request object representing the call parameters. Required. To specify no
|
2092
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2093
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2094
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2095
|
+
#
|
2096
|
+
# @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
|
2097
|
+
# Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
|
2098
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2099
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2100
|
+
#
|
2101
|
+
# @param parent [::String]
|
2102
|
+
# Required. The resource name of the file, in form of
|
2103
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
2104
|
+
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
2105
|
+
# Inline file source.
|
2106
|
+
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
2107
|
+
# Google Cloud Storage file source.
|
2108
|
+
#
|
2109
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2110
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
2111
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2112
|
+
#
|
2113
|
+
# @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
2114
|
+
#
|
2115
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2116
|
+
#
|
2117
|
+
# @example Basic example
|
2118
|
+
# require "google/cloud/translate/v3"
|
2119
|
+
#
|
2120
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2121
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2122
|
+
#
|
2123
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2124
|
+
# request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
|
2125
|
+
#
|
2126
|
+
# # Call the import_adaptive_mt_file method.
|
2127
|
+
# result = client.import_adaptive_mt_file request
|
2128
|
+
#
|
2129
|
+
# # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
|
2130
|
+
# p result
|
2131
|
+
#
|
2132
|
+
def import_adaptive_mt_file request, options = nil
|
2133
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2134
|
+
|
2135
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
|
2136
|
+
|
2137
|
+
# Converts hash and nil to an options object
|
2138
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2139
|
+
|
2140
|
+
# Customize the options with defaults
|
2141
|
+
metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
|
2142
|
+
|
2143
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2144
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2145
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2146
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2147
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2148
|
+
|
2149
|
+
header_params = {}
|
2150
|
+
if request.parent
|
2151
|
+
header_params["parent"] = request.parent
|
2152
|
+
end
|
2153
|
+
|
2154
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2155
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2156
|
+
|
2157
|
+
options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
|
2158
|
+
metadata: metadata,
|
2159
|
+
retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
|
2160
|
+
|
2161
|
+
options.apply_defaults timeout: @config.timeout,
|
2162
|
+
metadata: @config.metadata,
|
2163
|
+
retry_policy: @config.retry_policy
|
2164
|
+
|
2165
|
+
@translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation|
|
2166
|
+
yield response, operation if block_given?
|
2167
|
+
return response
|
2168
|
+
end
|
2169
|
+
rescue ::GRPC::BadStatus => e
|
2170
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2171
|
+
end
|
2172
|
+
|
2173
|
+
##
|
2174
|
+
# Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
2175
|
+
#
|
2176
|
+
# @overload list_adaptive_mt_files(request, options = nil)
|
2177
|
+
# Pass arguments to `list_adaptive_mt_files` via a request object, either of type
|
2178
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
|
2179
|
+
#
|
2180
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
|
2181
|
+
# A request object representing the call parameters. Required. To specify no
|
2182
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2183
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2184
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2185
|
+
#
|
2186
|
+
# @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
|
2187
|
+
# Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
|
2188
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2189
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2190
|
+
#
|
2191
|
+
# @param parent [::String]
|
2192
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2193
|
+
# MT files.
|
2194
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2195
|
+
# @param page_size [::Integer]
|
2196
|
+
# Optional.
|
2197
|
+
# @param page_token [::String]
|
2198
|
+
# Optional. A token identifying a page of results the server should return.
|
2199
|
+
# Typically, this is the value of
|
2200
|
+
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
2201
|
+
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
2202
|
+
# returned if `page_token`is empty or missing.
|
2203
|
+
#
|
2204
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2205
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2206
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2207
|
+
#
|
2208
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2209
|
+
#
|
2210
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2211
|
+
#
|
2212
|
+
# @example Basic example
|
2213
|
+
# require "google/cloud/translate/v3"
|
2214
|
+
#
|
2215
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2216
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2217
|
+
#
|
2218
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2219
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
|
2220
|
+
#
|
2221
|
+
# # Call the list_adaptive_mt_files method.
|
2222
|
+
# result = client.list_adaptive_mt_files request
|
2223
|
+
#
|
2224
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2225
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2226
|
+
# result.each do |item|
|
2227
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
2228
|
+
# p item
|
2229
|
+
# end
|
2230
|
+
#
|
2231
|
+
def list_adaptive_mt_files request, options = nil
|
2232
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2233
|
+
|
2234
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
|
2235
|
+
|
2236
|
+
# Converts hash and nil to an options object
|
2237
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2238
|
+
|
2239
|
+
# Customize the options with defaults
|
2240
|
+
metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
|
2241
|
+
|
2242
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2243
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2244
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2245
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2246
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2247
|
+
|
2248
|
+
header_params = {}
|
2249
|
+
if request.parent
|
2250
|
+
header_params["parent"] = request.parent
|
2251
|
+
end
|
2252
|
+
|
2253
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2254
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2255
|
+
|
2256
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
|
2257
|
+
metadata: metadata,
|
2258
|
+
retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
|
2259
|
+
|
2260
|
+
options.apply_defaults timeout: @config.timeout,
|
2261
|
+
metadata: @config.metadata,
|
2262
|
+
retry_policy: @config.retry_policy
|
2263
|
+
|
2264
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation|
|
2265
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options
|
2266
|
+
yield response, operation if block_given?
|
2267
|
+
return response
|
2268
|
+
end
|
2269
|
+
rescue ::GRPC::BadStatus => e
|
2270
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2271
|
+
end
|
2272
|
+
|
2273
|
+
##
|
2274
|
+
# Lists all AdaptiveMtSentences under a given file/dataset.
|
2275
|
+
#
|
2276
|
+
# @overload list_adaptive_mt_sentences(request, options = nil)
|
2277
|
+
# Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
|
2278
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
|
2279
|
+
#
|
2280
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
|
2281
|
+
# A request object representing the call parameters. Required. To specify no
|
2282
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2283
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2284
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2285
|
+
#
|
2286
|
+
# @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
|
2287
|
+
# Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
|
2288
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2289
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2290
|
+
#
|
2291
|
+
# @param parent [::String]
|
2292
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2293
|
+
# MT files. The following format lists all sentences under a file.
|
2294
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2295
|
+
# The following format lists all sentences within a dataset.
|
2296
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2297
|
+
# @param page_size [::Integer]
|
2298
|
+
# @param page_token [::String]
|
2299
|
+
# A token identifying a page of results the server should return.
|
2300
|
+
# Typically, this is the value of
|
2301
|
+
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
2302
|
+
# previous call to `ListTranslationMemories` method. The first page is
|
2303
|
+
# returned if `page_token` is empty or missing.
|
2304
|
+
#
|
2305
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2306
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2307
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2308
|
+
#
|
2309
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2310
|
+
#
|
2311
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2312
|
+
#
|
2313
|
+
# @example Basic example
|
2314
|
+
# require "google/cloud/translate/v3"
|
2315
|
+
#
|
2316
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2317
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Client.new
|
2318
|
+
#
|
2319
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2320
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
|
2321
|
+
#
|
2322
|
+
# # Call the list_adaptive_mt_sentences method.
|
2323
|
+
# result = client.list_adaptive_mt_sentences request
|
2324
|
+
#
|
2325
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2326
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2327
|
+
# result.each do |item|
|
2328
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
|
2329
|
+
# p item
|
2330
|
+
# end
|
2331
|
+
#
|
2332
|
+
def list_adaptive_mt_sentences request, options = nil
|
2333
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2334
|
+
|
2335
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
|
2336
|
+
|
2337
|
+
# Converts hash and nil to an options object
|
2338
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2339
|
+
|
2340
|
+
# Customize the options with defaults
|
2341
|
+
metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
|
2342
|
+
|
2343
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2344
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2345
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2346
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
2347
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2348
|
+
|
2349
|
+
header_params = {}
|
2350
|
+
if request.parent
|
2351
|
+
header_params["parent"] = request.parent
|
2352
|
+
end
|
2353
|
+
|
2354
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2355
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2356
|
+
|
2357
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
|
2358
|
+
metadata: metadata,
|
2359
|
+
retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
|
2360
|
+
|
2361
|
+
options.apply_defaults timeout: @config.timeout,
|
2362
|
+
metadata: @config.metadata,
|
2363
|
+
retry_policy: @config.retry_policy
|
2364
|
+
|
2365
|
+
@translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation|
|
2366
|
+
response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options
|
2367
|
+
yield response, operation if block_given?
|
2368
|
+
return response
|
2369
|
+
end
|
2370
|
+
rescue ::GRPC::BadStatus => e
|
2371
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2372
|
+
end
|
2373
|
+
|
2374
|
+
##
|
2375
|
+
# Configuration class for the TranslationService API.
|
2376
|
+
#
|
2377
|
+
# This class represents the configuration for TranslationService,
|
2378
|
+
# providing control over timeouts, retry behavior, logging, transport
|
2379
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
2380
|
+
# applied individually to specific RPCs. See
|
2381
|
+
# {::Google::Cloud::Translate::V3::TranslationService::Client::Configuration::Rpcs}
|
2382
|
+
# for a list of RPCs that can be configured independently.
|
2383
|
+
#
|
2384
|
+
# Configuration can be applied globally to all clients, or to a single client
|
2385
|
+
# on construction.
|
2386
|
+
#
|
2387
|
+
# @example
|
2388
|
+
#
|
2389
|
+
# # Modify the global config, setting the timeout for
|
2390
|
+
# # translate_text to 20 seconds,
|
2391
|
+
# # and all remaining timeouts to 10 seconds.
|
2392
|
+
# ::Google::Cloud::Translate::V3::TranslationService::Client.configure do |config|
|
2393
|
+
# config.timeout = 10.0
|
2394
|
+
# config.rpcs.translate_text.timeout = 20.0
|
2395
|
+
# end
|
2396
|
+
#
|
2397
|
+
# # Apply the above configuration only to a new client.
|
2398
|
+
# client = ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config|
|
2399
|
+
# config.timeout = 10.0
|
2400
|
+
# config.rpcs.translate_text.timeout = 20.0
|
2401
|
+
# end
|
2402
|
+
#
|
2403
|
+
# @!attribute [rw] endpoint
|
2404
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
2405
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
2406
|
+
# @return [::String,nil]
|
2407
|
+
# @!attribute [rw] credentials
|
2408
|
+
# Credentials to send with calls. You may provide any of the following types:
|
2409
|
+
# * (`String`) The path to a service account key file in JSON format
|
2410
|
+
# * (`Hash`) A service account key as a Hash
|
2411
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
2412
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
2413
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
2414
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
2415
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
2416
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
2417
|
+
# * (`nil`) indicating no credentials
|
2418
|
+
# @return [::Object]
|
2419
|
+
# @!attribute [rw] scope
|
2420
|
+
# The OAuth scopes
|
2421
|
+
# @return [::Array<::String>]
|
2422
|
+
# @!attribute [rw] lib_name
|
2423
|
+
# The library name as recorded in instrumentation and logging
|
2424
|
+
# @return [::String]
|
2425
|
+
# @!attribute [rw] lib_version
|
2426
|
+
# The library version as recorded in instrumentation and logging
|
2427
|
+
# @return [::String]
|
2428
|
+
# @!attribute [rw] channel_args
|
2429
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
2430
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
2431
|
+
# @return [::Hash]
|
2432
|
+
# @!attribute [rw] interceptors
|
2433
|
+
# An array of interceptors that are run before calls are executed.
|
2434
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
2435
|
+
# @!attribute [rw] timeout
|
2436
|
+
# The call timeout in seconds.
|
2437
|
+
# @return [::Numeric]
|
2438
|
+
# @!attribute [rw] metadata
|
2439
|
+
# Additional gRPC headers to be sent with the call.
|
2440
|
+
# @return [::Hash{::Symbol=>::String}]
|
2441
|
+
# @!attribute [rw] retry_policy
|
2442
|
+
# The retry policy. The value is a hash with the following keys:
|
2443
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2444
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2445
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2446
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2447
|
+
# trigger a retry.
|
2448
|
+
# @return [::Hash]
|
2449
|
+
# @!attribute [rw] quota_project
|
2450
|
+
# A separate project against which to charge quota.
|
2451
|
+
# @return [::String]
|
2452
|
+
# @!attribute [rw] universe_domain
|
2453
|
+
# The universe domain within which to make requests. This determines the
|
2454
|
+
# default endpoint URL. The default value of nil uses the environment
|
2455
|
+
# universe (usually the default "googleapis.com" universe).
|
2456
|
+
# @return [::String,nil]
|
2457
|
+
#
|
2458
|
+
class Configuration
|
2459
|
+
extend ::Gapic::Config
|
2460
|
+
|
2461
|
+
# @private
|
2462
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
2463
|
+
DEFAULT_ENDPOINT = "translate.googleapis.com"
|
2464
|
+
|
2465
|
+
config_attr :endpoint, nil, ::String, nil
|
2466
|
+
config_attr :credentials, nil do |value|
|
2467
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
2468
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
2469
|
+
allowed.any? { |klass| klass === value }
|
2470
|
+
end
|
2471
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
2472
|
+
config_attr :lib_name, nil, ::String, nil
|
2473
|
+
config_attr :lib_version, nil, ::String, nil
|
2474
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
2475
|
+
config_attr :interceptors, nil, ::Array, nil
|
2476
|
+
config_attr :timeout, nil, ::Numeric, nil
|
2477
|
+
config_attr :metadata, nil, ::Hash, nil
|
2478
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
2479
|
+
config_attr :quota_project, nil, ::String, nil
|
2480
|
+
config_attr :universe_domain, nil, ::String, nil
|
2481
|
+
|
2482
|
+
# @private
|
2483
|
+
def initialize parent_config = nil
|
2484
|
+
@parent_config = parent_config unless parent_config.nil?
|
2485
|
+
|
2486
|
+
yield self if block_given?
|
2487
|
+
end
|
2488
|
+
|
2489
|
+
##
|
2490
|
+
# Configurations for individual RPCs
|
2491
|
+
# @return [Rpcs]
|
2492
|
+
#
|
2493
|
+
def rpcs
|
2494
|
+
@rpcs ||= begin
|
2495
|
+
parent_rpcs = nil
|
2496
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
2497
|
+
Rpcs.new parent_rpcs
|
2498
|
+
end
|
2499
|
+
end
|
2500
|
+
|
2501
|
+
##
|
2502
|
+
# Configuration for the channel pool
|
2503
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
2504
|
+
#
|
2505
|
+
def channel_pool
|
2506
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
2507
|
+
end
|
2508
|
+
|
2509
|
+
##
|
2510
|
+
# Configuration RPC class for the TranslationService API.
|
2511
|
+
#
|
2512
|
+
# Includes fields providing the configuration for each RPC in this service.
|
2513
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2514
|
+
# the following configuration fields:
|
2515
|
+
#
|
2516
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
2517
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
2518
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2519
|
+
# include the following keys:
|
2520
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2521
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2522
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2523
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2524
|
+
# trigger a retry.
|
2525
|
+
#
|
2526
|
+
class Rpcs
|
2527
|
+
##
|
2528
|
+
# RPC-specific configuration for `translate_text`
|
2529
|
+
# @return [::Gapic::Config::Method]
|
2530
|
+
#
|
2531
|
+
attr_reader :translate_text
|
2532
|
+
##
|
2533
|
+
# RPC-specific configuration for `detect_language`
|
2534
|
+
# @return [::Gapic::Config::Method]
|
2535
|
+
#
|
2536
|
+
attr_reader :detect_language
|
2537
|
+
##
|
2538
|
+
# RPC-specific configuration for `get_supported_languages`
|
2539
|
+
# @return [::Gapic::Config::Method]
|
2540
|
+
#
|
2541
|
+
attr_reader :get_supported_languages
|
1597
2542
|
##
|
1598
2543
|
# RPC-specific configuration for `translate_document`
|
1599
2544
|
# @return [::Gapic::Config::Method]
|
@@ -1629,6 +2574,56 @@ module Google
|
|
1629
2574
|
# @return [::Gapic::Config::Method]
|
1630
2575
|
#
|
1631
2576
|
attr_reader :delete_glossary
|
2577
|
+
##
|
2578
|
+
# RPC-specific configuration for `create_adaptive_mt_dataset`
|
2579
|
+
# @return [::Gapic::Config::Method]
|
2580
|
+
#
|
2581
|
+
attr_reader :create_adaptive_mt_dataset
|
2582
|
+
##
|
2583
|
+
# RPC-specific configuration for `delete_adaptive_mt_dataset`
|
2584
|
+
# @return [::Gapic::Config::Method]
|
2585
|
+
#
|
2586
|
+
attr_reader :delete_adaptive_mt_dataset
|
2587
|
+
##
|
2588
|
+
# RPC-specific configuration for `get_adaptive_mt_dataset`
|
2589
|
+
# @return [::Gapic::Config::Method]
|
2590
|
+
#
|
2591
|
+
attr_reader :get_adaptive_mt_dataset
|
2592
|
+
##
|
2593
|
+
# RPC-specific configuration for `list_adaptive_mt_datasets`
|
2594
|
+
# @return [::Gapic::Config::Method]
|
2595
|
+
#
|
2596
|
+
attr_reader :list_adaptive_mt_datasets
|
2597
|
+
##
|
2598
|
+
# RPC-specific configuration for `adaptive_mt_translate`
|
2599
|
+
# @return [::Gapic::Config::Method]
|
2600
|
+
#
|
2601
|
+
attr_reader :adaptive_mt_translate
|
2602
|
+
##
|
2603
|
+
# RPC-specific configuration for `get_adaptive_mt_file`
|
2604
|
+
# @return [::Gapic::Config::Method]
|
2605
|
+
#
|
2606
|
+
attr_reader :get_adaptive_mt_file
|
2607
|
+
##
|
2608
|
+
# RPC-specific configuration for `delete_adaptive_mt_file`
|
2609
|
+
# @return [::Gapic::Config::Method]
|
2610
|
+
#
|
2611
|
+
attr_reader :delete_adaptive_mt_file
|
2612
|
+
##
|
2613
|
+
# RPC-specific configuration for `import_adaptive_mt_file`
|
2614
|
+
# @return [::Gapic::Config::Method]
|
2615
|
+
#
|
2616
|
+
attr_reader :import_adaptive_mt_file
|
2617
|
+
##
|
2618
|
+
# RPC-specific configuration for `list_adaptive_mt_files`
|
2619
|
+
# @return [::Gapic::Config::Method]
|
2620
|
+
#
|
2621
|
+
attr_reader :list_adaptive_mt_files
|
2622
|
+
##
|
2623
|
+
# RPC-specific configuration for `list_adaptive_mt_sentences`
|
2624
|
+
# @return [::Gapic::Config::Method]
|
2625
|
+
#
|
2626
|
+
attr_reader :list_adaptive_mt_sentences
|
1632
2627
|
|
1633
2628
|
# @private
|
1634
2629
|
def initialize parent_rpcs = nil
|
@@ -1652,6 +2647,26 @@ module Google
|
|
1652
2647
|
@get_glossary = ::Gapic::Config::Method.new get_glossary_config
|
1653
2648
|
delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
|
1654
2649
|
@delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
|
2650
|
+
create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
|
2651
|
+
@create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
|
2652
|
+
delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
|
2653
|
+
@delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config
|
2654
|
+
get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset
|
2655
|
+
@get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config
|
2656
|
+
list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets
|
2657
|
+
@list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config
|
2658
|
+
adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate
|
2659
|
+
@adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config
|
2660
|
+
get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file
|
2661
|
+
@get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config
|
2662
|
+
delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file
|
2663
|
+
@delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config
|
2664
|
+
import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file
|
2665
|
+
@import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config
|
2666
|
+
list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files
|
2667
|
+
@list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
|
2668
|
+
list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
|
2669
|
+
@list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
|
1655
2670
|
|
1656
2671
|
yield self if block_given?
|
1657
2672
|
end
|