google-cloud-translate-v3 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/translate/v3/adaptive_mt_pb.rb +67 -0
- data/lib/google/cloud/translate/v3/common_pb.rb +46 -0
- data/lib/google/cloud/translate/v3/translation_service/client.rb +1004 -4
- data/lib/google/cloud/translate/v3/translation_service/operations.rb +10 -1
- data/lib/google/cloud/translate/v3/translation_service/paths.rb +40 -0
- data/lib/google/cloud/translate/v3/translation_service/rest/client.rb +1219 -106
- data/lib/google/cloud/translate/v3/translation_service/rest/operations.rb +98 -0
- 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/api/field_behavior.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
@@ -267,6 +267,22 @@ module Google
|
|
267
267
|
# @return [::Google::Cloud::Translate::V3::TranslateTextResponse]
|
268
268
|
#
|
269
269
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
270
|
+
#
|
271
|
+
# @example Basic example
|
272
|
+
# require "google/cloud/translate/v3"
|
273
|
+
#
|
274
|
+
# # Create a client object. The client can be reused for multiple calls.
|
275
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
276
|
+
#
|
277
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
278
|
+
# request = Google::Cloud::Translate::V3::TranslateTextRequest.new
|
279
|
+
#
|
280
|
+
# # Call the translate_text method.
|
281
|
+
# result = client.translate_text request
|
282
|
+
#
|
283
|
+
# # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse.
|
284
|
+
# p result
|
285
|
+
#
|
270
286
|
def translate_text request, options = nil
|
271
287
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
272
288
|
|
@@ -364,6 +380,22 @@ module Google
|
|
364
380
|
# @return [::Google::Cloud::Translate::V3::DetectLanguageResponse]
|
365
381
|
#
|
366
382
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
383
|
+
#
|
384
|
+
# @example Basic example
|
385
|
+
# require "google/cloud/translate/v3"
|
386
|
+
#
|
387
|
+
# # Create a client object. The client can be reused for multiple calls.
|
388
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
389
|
+
#
|
390
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
391
|
+
# request = Google::Cloud::Translate::V3::DetectLanguageRequest.new
|
392
|
+
#
|
393
|
+
# # Call the detect_language method.
|
394
|
+
# result = client.detect_language request
|
395
|
+
#
|
396
|
+
# # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse.
|
397
|
+
# p result
|
398
|
+
#
|
367
399
|
def detect_language request, options = nil
|
368
400
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
369
401
|
|
@@ -456,6 +488,22 @@ module Google
|
|
456
488
|
# @return [::Google::Cloud::Translate::V3::SupportedLanguages]
|
457
489
|
#
|
458
490
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
491
|
+
#
|
492
|
+
# @example Basic example
|
493
|
+
# require "google/cloud/translate/v3"
|
494
|
+
#
|
495
|
+
# # Create a client object. The client can be reused for multiple calls.
|
496
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
497
|
+
#
|
498
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
499
|
+
# request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new
|
500
|
+
#
|
501
|
+
# # Call the get_supported_languages method.
|
502
|
+
# result = client.get_supported_languages request
|
503
|
+
#
|
504
|
+
# # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages.
|
505
|
+
# p result
|
506
|
+
#
|
459
507
|
def get_supported_languages request, options = nil
|
460
508
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
461
509
|
|
@@ -591,6 +639,22 @@ module Google
|
|
591
639
|
# @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse]
|
592
640
|
#
|
593
641
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
642
|
+
#
|
643
|
+
# @example Basic example
|
644
|
+
# require "google/cloud/translate/v3"
|
645
|
+
#
|
646
|
+
# # Create a client object. The client can be reused for multiple calls.
|
647
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
648
|
+
#
|
649
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
650
|
+
# request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new
|
651
|
+
#
|
652
|
+
# # Call the translate_document method.
|
653
|
+
# result = client.translate_document request
|
654
|
+
#
|
655
|
+
# # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse.
|
656
|
+
# p result
|
657
|
+
#
|
594
658
|
def translate_document request, options = nil
|
595
659
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
596
660
|
|
@@ -709,6 +773,29 @@ module Google
|
|
709
773
|
# @return [::Gapic::Operation]
|
710
774
|
#
|
711
775
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
776
|
+
#
|
777
|
+
# @example Basic example
|
778
|
+
# require "google/cloud/translate/v3"
|
779
|
+
#
|
780
|
+
# # Create a client object. The client can be reused for multiple calls.
|
781
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
782
|
+
#
|
783
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
784
|
+
# request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new
|
785
|
+
#
|
786
|
+
# # Call the batch_translate_text method.
|
787
|
+
# result = client.batch_translate_text request
|
788
|
+
#
|
789
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
790
|
+
# # check the status of an operation, cancel it, or wait for results.
|
791
|
+
# # Here is how to wait for a response.
|
792
|
+
# result.wait_until_done! timeout: 60
|
793
|
+
# if result.response?
|
794
|
+
# p result.response
|
795
|
+
# else
|
796
|
+
# puts "No response received."
|
797
|
+
# end
|
798
|
+
#
|
712
799
|
def batch_translate_text request, options = nil
|
713
800
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
714
801
|
|
@@ -814,9 +901,9 @@ module Google
|
|
814
901
|
# @param glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}]
|
815
902
|
# Optional. Glossaries to be applied. It's keyed by target language code.
|
816
903
|
# @param format_conversions [::Hash{::String => ::String}]
|
817
|
-
# Optional.
|
818
|
-
#
|
819
|
-
# translated documents.
|
904
|
+
# Optional. The file format conversion map that is applied to all input
|
905
|
+
# files. The map key is the original mime_type. The map value is the target
|
906
|
+
# mime_type of translated documents.
|
820
907
|
#
|
821
908
|
# Supported file format conversion includes:
|
822
909
|
# - `application/pdf` to
|
@@ -843,6 +930,29 @@ module Google
|
|
843
930
|
# @return [::Gapic::Operation]
|
844
931
|
#
|
845
932
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
933
|
+
#
|
934
|
+
# @example Basic example
|
935
|
+
# require "google/cloud/translate/v3"
|
936
|
+
#
|
937
|
+
# # Create a client object. The client can be reused for multiple calls.
|
938
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
939
|
+
#
|
940
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
941
|
+
# request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new
|
942
|
+
#
|
943
|
+
# # Call the batch_translate_document method.
|
944
|
+
# result = client.batch_translate_document request
|
945
|
+
#
|
946
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
947
|
+
# # check the status of an operation, cancel it, or wait for results.
|
948
|
+
# # Here is how to wait for a response.
|
949
|
+
# result.wait_until_done! timeout: 60
|
950
|
+
# if result.response?
|
951
|
+
# p result.response
|
952
|
+
# else
|
953
|
+
# puts "No response received."
|
954
|
+
# end
|
955
|
+
#
|
846
956
|
def batch_translate_document request, options = nil
|
847
957
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
848
958
|
|
@@ -909,6 +1019,29 @@ module Google
|
|
909
1019
|
# @return [::Gapic::Operation]
|
910
1020
|
#
|
911
1021
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1022
|
+
#
|
1023
|
+
# @example Basic example
|
1024
|
+
# require "google/cloud/translate/v3"
|
1025
|
+
#
|
1026
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1027
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1028
|
+
#
|
1029
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1030
|
+
# request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new
|
1031
|
+
#
|
1032
|
+
# # Call the create_glossary method.
|
1033
|
+
# result = client.create_glossary request
|
1034
|
+
#
|
1035
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
1036
|
+
# # check the status of an operation, cancel it, or wait for results.
|
1037
|
+
# # Here is how to wait for a response.
|
1038
|
+
# result.wait_until_done! timeout: 60
|
1039
|
+
# if result.response?
|
1040
|
+
# p result.response
|
1041
|
+
# else
|
1042
|
+
# puts "No response received."
|
1043
|
+
# end
|
1044
|
+
#
|
912
1045
|
def create_glossary request, options = nil
|
913
1046
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
914
1047
|
|
@@ -998,6 +1131,26 @@ module Google
|
|
998
1131
|
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>]
|
999
1132
|
#
|
1000
1133
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1134
|
+
#
|
1135
|
+
# @example Basic example
|
1136
|
+
# require "google/cloud/translate/v3"
|
1137
|
+
#
|
1138
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1139
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1140
|
+
#
|
1141
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1142
|
+
# request = Google::Cloud::Translate::V3::ListGlossariesRequest.new
|
1143
|
+
#
|
1144
|
+
# # Call the list_glossaries method.
|
1145
|
+
# result = client.list_glossaries request
|
1146
|
+
#
|
1147
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1148
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1149
|
+
# result.each do |item|
|
1150
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::Glossary.
|
1151
|
+
# p item
|
1152
|
+
# end
|
1153
|
+
#
|
1001
1154
|
def list_glossaries request, options = nil
|
1002
1155
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1003
1156
|
|
@@ -1062,6 +1215,22 @@ module Google
|
|
1062
1215
|
# @return [::Google::Cloud::Translate::V3::Glossary]
|
1063
1216
|
#
|
1064
1217
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1218
|
+
#
|
1219
|
+
# @example Basic example
|
1220
|
+
# require "google/cloud/translate/v3"
|
1221
|
+
#
|
1222
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1223
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1224
|
+
#
|
1225
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1226
|
+
# request = Google::Cloud::Translate::V3::GetGlossaryRequest.new
|
1227
|
+
#
|
1228
|
+
# # Call the get_glossary method.
|
1229
|
+
# result = client.get_glossary request
|
1230
|
+
#
|
1231
|
+
# # The returned object is of type Google::Cloud::Translate::V3::Glossary.
|
1232
|
+
# p result
|
1233
|
+
#
|
1065
1234
|
def get_glossary request, options = nil
|
1066
1235
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1067
1236
|
|
@@ -1126,6 +1295,29 @@ module Google
|
|
1126
1295
|
# @return [::Gapic::Operation]
|
1127
1296
|
#
|
1128
1297
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1298
|
+
#
|
1299
|
+
# @example Basic example
|
1300
|
+
# require "google/cloud/translate/v3"
|
1301
|
+
#
|
1302
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1303
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1304
|
+
#
|
1305
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1306
|
+
# request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new
|
1307
|
+
#
|
1308
|
+
# # Call the delete_glossary method.
|
1309
|
+
# result = client.delete_glossary request
|
1310
|
+
#
|
1311
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
1312
|
+
# # check the status of an operation, cancel it, or wait for results.
|
1313
|
+
# # Here is how to wait for a response.
|
1314
|
+
# result.wait_until_done! timeout: 60
|
1315
|
+
# if result.response?
|
1316
|
+
# p result.response
|
1317
|
+
# else
|
1318
|
+
# puts "No response received."
|
1319
|
+
# end
|
1320
|
+
#
|
1129
1321
|
def delete_glossary request, options = nil
|
1130
1322
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1131
1323
|
|
@@ -1163,124 +1355,975 @@ module Google
|
|
1163
1355
|
end
|
1164
1356
|
|
1165
1357
|
##
|
1166
|
-
#
|
1358
|
+
# Creates an Adaptive MT dataset.
|
1167
1359
|
#
|
1168
|
-
#
|
1169
|
-
#
|
1170
|
-
#
|
1171
|
-
# applied individually to specific RPCs. See
|
1172
|
-
# {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration::Rpcs}
|
1173
|
-
# for a list of RPCs that can be configured independently.
|
1360
|
+
# @overload create_adaptive_mt_dataset(request, options = nil)
|
1361
|
+
# Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
|
1362
|
+
# {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1174
1363
|
#
|
1175
|
-
#
|
1176
|
-
#
|
1364
|
+
# @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
|
1365
|
+
# A request object representing the call parameters. Required. To specify no
|
1366
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1367
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1368
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1177
1369
|
#
|
1178
|
-
# @
|
1370
|
+
# @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
|
1371
|
+
# Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
|
1372
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1373
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1179
1374
|
#
|
1180
|
-
#
|
1181
|
-
#
|
1182
|
-
#
|
1183
|
-
# ::Google::Cloud::Translate::V3::
|
1184
|
-
#
|
1185
|
-
#
|
1186
|
-
#
|
1375
|
+
# @param parent [::String]
|
1376
|
+
# Required. Name of the parent project. In form of
|
1377
|
+
# `projects/{project-number-or-id}/locations/{location-id}`
|
1378
|
+
# @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
|
1379
|
+
# Required. The AdaptiveMtDataset to be created.
|
1380
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1381
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1382
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1187
1383
|
#
|
1188
|
-
#
|
1189
|
-
# client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config|
|
1190
|
-
# config.timeout = 10.0
|
1191
|
-
# config.rpcs.translate_text.timeout = 20.0
|
1192
|
-
# end
|
1384
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1193
1385
|
#
|
1194
|
-
#
|
1195
|
-
# The hostname or hostname:port of the service endpoint.
|
1196
|
-
# Defaults to `"translate.googleapis.com"`.
|
1197
|
-
# @return [::String]
|
1198
|
-
# @!attribute [rw] credentials
|
1199
|
-
# Credentials to send with calls. You may provide any of the following types:
|
1200
|
-
# * (`String`) The path to a service account key file in JSON format
|
1201
|
-
# * (`Hash`) A service account key as a Hash
|
1202
|
-
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1203
|
-
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1204
|
-
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1205
|
-
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1206
|
-
# * (`nil`) indicating no credentials
|
1207
|
-
# @return [::Object]
|
1208
|
-
# @!attribute [rw] scope
|
1209
|
-
# The OAuth scopes
|
1210
|
-
# @return [::Array<::String>]
|
1211
|
-
# @!attribute [rw] lib_name
|
1212
|
-
# The library name as recorded in instrumentation and logging
|
1213
|
-
# @return [::String]
|
1214
|
-
# @!attribute [rw] lib_version
|
1215
|
-
# The library version as recorded in instrumentation and logging
|
1216
|
-
# @return [::String]
|
1217
|
-
# @!attribute [rw] timeout
|
1218
|
-
# The call timeout in seconds.
|
1219
|
-
# @return [::Numeric]
|
1220
|
-
# @!attribute [rw] metadata
|
1221
|
-
# Additional headers to be sent with the call.
|
1222
|
-
# @return [::Hash{::Symbol=>::String}]
|
1223
|
-
# @!attribute [rw] retry_policy
|
1224
|
-
# The retry policy. The value is a hash with the following keys:
|
1225
|
-
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1226
|
-
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1227
|
-
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1228
|
-
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1229
|
-
# trigger a retry.
|
1230
|
-
# @return [::Hash]
|
1231
|
-
# @!attribute [rw] quota_project
|
1232
|
-
# A separate project against which to charge quota.
|
1233
|
-
# @return [::String]
|
1386
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1234
1387
|
#
|
1235
|
-
|
1236
|
-
|
1388
|
+
# @example Basic example
|
1389
|
+
# require "google/cloud/translate/v3"
|
1390
|
+
#
|
1391
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1392
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1393
|
+
#
|
1394
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1395
|
+
# request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
|
1396
|
+
#
|
1397
|
+
# # Call the create_adaptive_mt_dataset method.
|
1398
|
+
# result = client.create_adaptive_mt_dataset request
|
1399
|
+
#
|
1400
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1401
|
+
# p result
|
1402
|
+
#
|
1403
|
+
def create_adaptive_mt_dataset request, options = nil
|
1404
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1237
1405
|
|
1238
|
-
|
1406
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
|
1239
1407
|
|
1240
|
-
|
1241
|
-
|
1242
|
-
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1243
|
-
allowed.any? { |klass| klass === value }
|
1244
|
-
end
|
1245
|
-
config_attr :scope, nil, ::String, ::Array, nil
|
1246
|
-
config_attr :lib_name, nil, ::String, nil
|
1247
|
-
config_attr :lib_version, nil, ::String, nil
|
1248
|
-
config_attr :timeout, nil, ::Numeric, nil
|
1249
|
-
config_attr :metadata, nil, ::Hash, nil
|
1250
|
-
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1251
|
-
config_attr :quota_project, nil, ::String, nil
|
1408
|
+
# Converts hash and nil to an options object
|
1409
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1252
1410
|
|
1253
|
-
#
|
1254
|
-
|
1255
|
-
@parent_config = parent_config unless parent_config.nil?
|
1411
|
+
# Customize the options with defaults
|
1412
|
+
call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
|
1256
1413
|
|
1257
|
-
|
1414
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1415
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1416
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1417
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1418
|
+
transports_version_send: [:rest]
|
1419
|
+
|
1420
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1421
|
+
|
1422
|
+
options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
|
1423
|
+
metadata: call_metadata,
|
1424
|
+
retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
|
1425
|
+
|
1426
|
+
options.apply_defaults timeout: @config.timeout,
|
1427
|
+
metadata: @config.metadata,
|
1428
|
+
retry_policy: @config.retry_policy
|
1429
|
+
|
1430
|
+
@translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation|
|
1431
|
+
yield result, operation if block_given?
|
1432
|
+
return result
|
1258
1433
|
end
|
1434
|
+
rescue ::Gapic::Rest::Error => e
|
1435
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1436
|
+
end
|
1259
1437
|
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1438
|
+
##
|
1439
|
+
# Deletes an Adaptive MT dataset, including all its entries and associated
|
1440
|
+
# metadata.
|
1441
|
+
#
|
1442
|
+
# @overload delete_adaptive_mt_dataset(request, options = nil)
|
1443
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
|
1444
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1445
|
+
#
|
1446
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
|
1447
|
+
# A request object representing the call parameters. Required. To specify no
|
1448
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1449
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1450
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1451
|
+
#
|
1452
|
+
# @overload delete_adaptive_mt_dataset(name: nil)
|
1453
|
+
# Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
|
1454
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1455
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1456
|
+
#
|
1457
|
+
# @param name [::String]
|
1458
|
+
# Required. Name of the dataset. In the form of
|
1459
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1460
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1461
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1462
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1463
|
+
#
|
1464
|
+
# @return [::Google::Protobuf::Empty]
|
1465
|
+
#
|
1466
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1467
|
+
#
|
1468
|
+
# @example Basic example
|
1469
|
+
# require "google/cloud/translate/v3"
|
1470
|
+
#
|
1471
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1472
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1473
|
+
#
|
1474
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1475
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
|
1476
|
+
#
|
1477
|
+
# # Call the delete_adaptive_mt_dataset method.
|
1478
|
+
# result = client.delete_adaptive_mt_dataset request
|
1479
|
+
#
|
1480
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1481
|
+
# p result
|
1482
|
+
#
|
1483
|
+
def delete_adaptive_mt_dataset request, options = nil
|
1484
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1485
|
+
|
1486
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
|
1487
|
+
|
1488
|
+
# Converts hash and nil to an options object
|
1489
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1490
|
+
|
1491
|
+
# Customize the options with defaults
|
1492
|
+
call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
|
1493
|
+
|
1494
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1495
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1496
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1497
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1498
|
+
transports_version_send: [:rest]
|
1499
|
+
|
1500
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1501
|
+
|
1502
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
|
1503
|
+
metadata: call_metadata,
|
1504
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
|
1505
|
+
|
1506
|
+
options.apply_defaults timeout: @config.timeout,
|
1507
|
+
metadata: @config.metadata,
|
1508
|
+
retry_policy: @config.retry_policy
|
1509
|
+
|
1510
|
+
@translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation|
|
1511
|
+
yield result, operation if block_given?
|
1512
|
+
return result
|
1270
1513
|
end
|
1514
|
+
rescue ::Gapic::Rest::Error => e
|
1515
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1516
|
+
end
|
1271
1517
|
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1518
|
+
##
|
1519
|
+
# Gets the Adaptive MT dataset.
|
1520
|
+
#
|
1521
|
+
# @overload get_adaptive_mt_dataset(request, options = nil)
|
1522
|
+
# Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
|
1523
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
|
1524
|
+
#
|
1525
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
|
1526
|
+
# A request object representing the call parameters. Required. To specify no
|
1527
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1528
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1529
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1530
|
+
#
|
1531
|
+
# @overload get_adaptive_mt_dataset(name: nil)
|
1532
|
+
# Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
|
1533
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1534
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1535
|
+
#
|
1536
|
+
# @param name [::String]
|
1537
|
+
# Required. Name of the dataset. In the form of
|
1538
|
+
# `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
|
1539
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1540
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1541
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1542
|
+
#
|
1543
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
|
1544
|
+
#
|
1545
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1546
|
+
#
|
1547
|
+
# @example Basic example
|
1548
|
+
# require "google/cloud/translate/v3"
|
1549
|
+
#
|
1550
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1551
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1552
|
+
#
|
1553
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1554
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
|
1555
|
+
#
|
1556
|
+
# # Call the get_adaptive_mt_dataset method.
|
1557
|
+
# result = client.get_adaptive_mt_dataset request
|
1558
|
+
#
|
1559
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1560
|
+
# p result
|
1561
|
+
#
|
1562
|
+
def get_adaptive_mt_dataset request, options = nil
|
1563
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1564
|
+
|
1565
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
|
1566
|
+
|
1567
|
+
# Converts hash and nil to an options object
|
1568
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1569
|
+
|
1570
|
+
# Customize the options with defaults
|
1571
|
+
call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
|
1572
|
+
|
1573
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1574
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1575
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1576
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1577
|
+
transports_version_send: [:rest]
|
1578
|
+
|
1579
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1580
|
+
|
1581
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
|
1582
|
+
metadata: call_metadata,
|
1583
|
+
retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
|
1584
|
+
|
1585
|
+
options.apply_defaults timeout: @config.timeout,
|
1586
|
+
metadata: @config.metadata,
|
1587
|
+
retry_policy: @config.retry_policy
|
1588
|
+
|
1589
|
+
@translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation|
|
1590
|
+
yield result, operation if block_given?
|
1591
|
+
return result
|
1592
|
+
end
|
1593
|
+
rescue ::Gapic::Rest::Error => e
|
1594
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
##
|
1598
|
+
# Lists all Adaptive MT datasets for which the caller has read permission.
|
1599
|
+
#
|
1600
|
+
# @overload list_adaptive_mt_datasets(request, options = nil)
|
1601
|
+
# Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
|
1602
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
|
1603
|
+
#
|
1604
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
|
1605
|
+
# A request object representing the call parameters. Required. To specify no
|
1606
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1607
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1608
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1609
|
+
#
|
1610
|
+
# @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
1611
|
+
# Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
|
1612
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1613
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1614
|
+
#
|
1615
|
+
# @param parent [::String]
|
1616
|
+
# Required. The resource name of the project from which to list the Adaptive
|
1617
|
+
# MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
|
1618
|
+
# @param page_size [::Integer]
|
1619
|
+
# Optional. Requested page size. The server may return fewer results than
|
1620
|
+
# requested. If unspecified, the server picks an appropriate default.
|
1621
|
+
# @param page_token [::String]
|
1622
|
+
# Optional. A token identifying a page of results the server should return.
|
1623
|
+
# Typically, this is the value of
|
1624
|
+
# ListAdaptiveMtDatasetsResponse.next_page_token returned from the
|
1625
|
+
# previous call to `ListAdaptiveMtDatasets` method. The first page is
|
1626
|
+
# returned if `page_token`is empty or missing.
|
1627
|
+
# @param filter [::String]
|
1628
|
+
# Optional. An expression for filtering the results of the request.
|
1629
|
+
# Filter is not supported yet.
|
1630
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1631
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1632
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1633
|
+
#
|
1634
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
|
1635
|
+
#
|
1636
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1637
|
+
#
|
1638
|
+
# @example Basic example
|
1639
|
+
# require "google/cloud/translate/v3"
|
1640
|
+
#
|
1641
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1642
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1643
|
+
#
|
1644
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1645
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
|
1646
|
+
#
|
1647
|
+
# # Call the list_adaptive_mt_datasets method.
|
1648
|
+
# result = client.list_adaptive_mt_datasets request
|
1649
|
+
#
|
1650
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1651
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1652
|
+
# result.each do |item|
|
1653
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
|
1654
|
+
# p item
|
1655
|
+
# end
|
1656
|
+
#
|
1657
|
+
def list_adaptive_mt_datasets request, options = nil
|
1658
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1659
|
+
|
1660
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
|
1661
|
+
|
1662
|
+
# Converts hash and nil to an options object
|
1663
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1664
|
+
|
1665
|
+
# Customize the options with defaults
|
1666
|
+
call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
|
1667
|
+
|
1668
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1669
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1670
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1671
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1672
|
+
transports_version_send: [:rest]
|
1673
|
+
|
1674
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1675
|
+
|
1676
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
|
1677
|
+
metadata: call_metadata,
|
1678
|
+
retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
|
1679
|
+
|
1680
|
+
options.apply_defaults timeout: @config.timeout,
|
1681
|
+
metadata: @config.metadata,
|
1682
|
+
retry_policy: @config.retry_policy
|
1683
|
+
|
1684
|
+
@translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation|
|
1685
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options
|
1686
|
+
yield result, operation if block_given?
|
1687
|
+
return result
|
1688
|
+
end
|
1689
|
+
rescue ::Gapic::Rest::Error => e
|
1690
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
##
|
1694
|
+
# Translate text using Adaptive MT.
|
1695
|
+
#
|
1696
|
+
# @overload adaptive_mt_translate(request, options = nil)
|
1697
|
+
# Pass arguments to `adaptive_mt_translate` via a request object, either of type
|
1698
|
+
# {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
|
1699
|
+
#
|
1700
|
+
# @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
|
1701
|
+
# A request object representing the call parameters. Required. To specify no
|
1702
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1703
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1704
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1705
|
+
#
|
1706
|
+
# @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil)
|
1707
|
+
# Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
|
1708
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1709
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1710
|
+
#
|
1711
|
+
# @param parent [::String]
|
1712
|
+
# Required. Location to make a regional call.
|
1713
|
+
#
|
1714
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
1715
|
+
# @param dataset [::String]
|
1716
|
+
# Required. The resource name for the dataset to use for adaptive MT.
|
1717
|
+
# `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
|
1718
|
+
# @param content [::Array<::String>]
|
1719
|
+
# Required. The content of the input in string format.
|
1720
|
+
# For now only one sentence per request is supported.
|
1721
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1722
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1723
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1724
|
+
#
|
1725
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
|
1726
|
+
#
|
1727
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1728
|
+
#
|
1729
|
+
# @example Basic example
|
1730
|
+
# require "google/cloud/translate/v3"
|
1731
|
+
#
|
1732
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1733
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1734
|
+
#
|
1735
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1736
|
+
# request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
|
1737
|
+
#
|
1738
|
+
# # Call the adaptive_mt_translate method.
|
1739
|
+
# result = client.adaptive_mt_translate request
|
1740
|
+
#
|
1741
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
|
1742
|
+
# p result
|
1743
|
+
#
|
1744
|
+
def adaptive_mt_translate request, options = nil
|
1745
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1746
|
+
|
1747
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
|
1748
|
+
|
1749
|
+
# Converts hash and nil to an options object
|
1750
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1751
|
+
|
1752
|
+
# Customize the options with defaults
|
1753
|
+
call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
|
1754
|
+
|
1755
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1756
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1757
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1758
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1759
|
+
transports_version_send: [:rest]
|
1760
|
+
|
1761
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1762
|
+
|
1763
|
+
options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
|
1764
|
+
metadata: call_metadata,
|
1765
|
+
retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
|
1766
|
+
|
1767
|
+
options.apply_defaults timeout: @config.timeout,
|
1768
|
+
metadata: @config.metadata,
|
1769
|
+
retry_policy: @config.retry_policy
|
1770
|
+
|
1771
|
+
@translation_service_stub.adaptive_mt_translate request, options do |result, operation|
|
1772
|
+
yield result, operation if block_given?
|
1773
|
+
return result
|
1774
|
+
end
|
1775
|
+
rescue ::Gapic::Rest::Error => e
|
1776
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
##
|
1780
|
+
# Gets and AdaptiveMtFile
|
1781
|
+
#
|
1782
|
+
# @overload get_adaptive_mt_file(request, options = nil)
|
1783
|
+
# Pass arguments to `get_adaptive_mt_file` via a request object, either of type
|
1784
|
+
# {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
|
1785
|
+
#
|
1786
|
+
# @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
|
1787
|
+
# A request object representing the call parameters. Required. To specify no
|
1788
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1789
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1790
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1791
|
+
#
|
1792
|
+
# @overload get_adaptive_mt_file(name: nil)
|
1793
|
+
# Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
|
1794
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1795
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1796
|
+
#
|
1797
|
+
# @param name [::String]
|
1798
|
+
# Required. The resource name of the file, in form of
|
1799
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1800
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1801
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1802
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1803
|
+
#
|
1804
|
+
# @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
|
1805
|
+
#
|
1806
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1807
|
+
#
|
1808
|
+
# @example Basic example
|
1809
|
+
# require "google/cloud/translate/v3"
|
1810
|
+
#
|
1811
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1812
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1813
|
+
#
|
1814
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1815
|
+
# request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
|
1816
|
+
#
|
1817
|
+
# # Call the get_adaptive_mt_file method.
|
1818
|
+
# result = client.get_adaptive_mt_file request
|
1819
|
+
#
|
1820
|
+
# # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
|
1821
|
+
# p result
|
1822
|
+
#
|
1823
|
+
def get_adaptive_mt_file request, options = nil
|
1824
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1825
|
+
|
1826
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
|
1827
|
+
|
1828
|
+
# Converts hash and nil to an options object
|
1829
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1830
|
+
|
1831
|
+
# Customize the options with defaults
|
1832
|
+
call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
|
1833
|
+
|
1834
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1835
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1836
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1837
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1838
|
+
transports_version_send: [:rest]
|
1839
|
+
|
1840
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1841
|
+
|
1842
|
+
options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
|
1843
|
+
metadata: call_metadata,
|
1844
|
+
retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
|
1845
|
+
|
1846
|
+
options.apply_defaults timeout: @config.timeout,
|
1847
|
+
metadata: @config.metadata,
|
1848
|
+
retry_policy: @config.retry_policy
|
1849
|
+
|
1850
|
+
@translation_service_stub.get_adaptive_mt_file request, options do |result, operation|
|
1851
|
+
yield result, operation if block_given?
|
1852
|
+
return result
|
1853
|
+
end
|
1854
|
+
rescue ::Gapic::Rest::Error => e
|
1855
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1856
|
+
end
|
1857
|
+
|
1858
|
+
##
|
1859
|
+
# Deletes an AdaptiveMtFile along with its sentences.
|
1860
|
+
#
|
1861
|
+
# @overload delete_adaptive_mt_file(request, options = nil)
|
1862
|
+
# Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
|
1863
|
+
# {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
|
1864
|
+
#
|
1865
|
+
# @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
|
1866
|
+
# A request object representing the call parameters. Required. To specify no
|
1867
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1868
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1869
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1870
|
+
#
|
1871
|
+
# @overload delete_adaptive_mt_file(name: nil)
|
1872
|
+
# Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
|
1873
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1874
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1875
|
+
#
|
1876
|
+
# @param name [::String]
|
1877
|
+
# Required. The resource name of the file to delete, in form of
|
1878
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
1879
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1880
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1881
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1882
|
+
#
|
1883
|
+
# @return [::Google::Protobuf::Empty]
|
1884
|
+
#
|
1885
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1886
|
+
#
|
1887
|
+
# @example Basic example
|
1888
|
+
# require "google/cloud/translate/v3"
|
1889
|
+
#
|
1890
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1891
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1892
|
+
#
|
1893
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1894
|
+
# request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
|
1895
|
+
#
|
1896
|
+
# # Call the delete_adaptive_mt_file method.
|
1897
|
+
# result = client.delete_adaptive_mt_file request
|
1898
|
+
#
|
1899
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1900
|
+
# p result
|
1901
|
+
#
|
1902
|
+
def delete_adaptive_mt_file request, options = nil
|
1903
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1904
|
+
|
1905
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
|
1906
|
+
|
1907
|
+
# Converts hash and nil to an options object
|
1908
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1909
|
+
|
1910
|
+
# Customize the options with defaults
|
1911
|
+
call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
|
1912
|
+
|
1913
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1914
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1915
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1916
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
1917
|
+
transports_version_send: [:rest]
|
1918
|
+
|
1919
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1920
|
+
|
1921
|
+
options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
|
1922
|
+
metadata: call_metadata,
|
1923
|
+
retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
|
1924
|
+
|
1925
|
+
options.apply_defaults timeout: @config.timeout,
|
1926
|
+
metadata: @config.metadata,
|
1927
|
+
retry_policy: @config.retry_policy
|
1928
|
+
|
1929
|
+
@translation_service_stub.delete_adaptive_mt_file request, options do |result, operation|
|
1930
|
+
yield result, operation if block_given?
|
1931
|
+
return result
|
1932
|
+
end
|
1933
|
+
rescue ::Gapic::Rest::Error => e
|
1934
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1935
|
+
end
|
1936
|
+
|
1937
|
+
##
|
1938
|
+
# Imports an AdaptiveMtFile and adds all of its sentences into the
|
1939
|
+
# AdaptiveMtDataset.
|
1940
|
+
#
|
1941
|
+
# @overload import_adaptive_mt_file(request, options = nil)
|
1942
|
+
# Pass arguments to `import_adaptive_mt_file` via a request object, either of type
|
1943
|
+
# {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
|
1944
|
+
#
|
1945
|
+
# @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
|
1946
|
+
# A request object representing the call parameters. Required. To specify no
|
1947
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1948
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1949
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1950
|
+
#
|
1951
|
+
# @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
|
1952
|
+
# Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
|
1953
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1954
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1955
|
+
#
|
1956
|
+
# @param parent [::String]
|
1957
|
+
# Required. The resource name of the file, in form of
|
1958
|
+
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
1959
|
+
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
1960
|
+
# Inline file source.
|
1961
|
+
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
1962
|
+
# Google Cloud Storage file source.
|
1963
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1964
|
+
# @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
1965
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1966
|
+
#
|
1967
|
+
# @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
1968
|
+
#
|
1969
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1970
|
+
#
|
1971
|
+
# @example Basic example
|
1972
|
+
# require "google/cloud/translate/v3"
|
1973
|
+
#
|
1974
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1975
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
1976
|
+
#
|
1977
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1978
|
+
# request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
|
1979
|
+
#
|
1980
|
+
# # Call the import_adaptive_mt_file method.
|
1981
|
+
# result = client.import_adaptive_mt_file request
|
1982
|
+
#
|
1983
|
+
# # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
|
1984
|
+
# p result
|
1985
|
+
#
|
1986
|
+
def import_adaptive_mt_file request, options = nil
|
1987
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1988
|
+
|
1989
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
|
1990
|
+
|
1991
|
+
# Converts hash and nil to an options object
|
1992
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1993
|
+
|
1994
|
+
# Customize the options with defaults
|
1995
|
+
call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
|
1996
|
+
|
1997
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1998
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1999
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2000
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2001
|
+
transports_version_send: [:rest]
|
2002
|
+
|
2003
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2004
|
+
|
2005
|
+
options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
|
2006
|
+
metadata: call_metadata,
|
2007
|
+
retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
|
2008
|
+
|
2009
|
+
options.apply_defaults timeout: @config.timeout,
|
2010
|
+
metadata: @config.metadata,
|
2011
|
+
retry_policy: @config.retry_policy
|
2012
|
+
|
2013
|
+
@translation_service_stub.import_adaptive_mt_file request, options do |result, operation|
|
2014
|
+
yield result, operation if block_given?
|
2015
|
+
return result
|
2016
|
+
end
|
2017
|
+
rescue ::Gapic::Rest::Error => e
|
2018
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2019
|
+
end
|
2020
|
+
|
2021
|
+
##
|
2022
|
+
# Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
2023
|
+
#
|
2024
|
+
# @overload list_adaptive_mt_files(request, options = nil)
|
2025
|
+
# Pass arguments to `list_adaptive_mt_files` via a request object, either of type
|
2026
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
|
2027
|
+
#
|
2028
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
|
2029
|
+
# A request object representing the call parameters. Required. To specify no
|
2030
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2031
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2032
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2033
|
+
#
|
2034
|
+
# @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
|
2035
|
+
# Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
|
2036
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2037
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2038
|
+
#
|
2039
|
+
# @param parent [::String]
|
2040
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2041
|
+
# MT files.
|
2042
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2043
|
+
# @param page_size [::Integer]
|
2044
|
+
# Optional.
|
2045
|
+
# @param page_token [::String]
|
2046
|
+
# Optional. A token identifying a page of results the server should return.
|
2047
|
+
# Typically, this is the value of
|
2048
|
+
# ListAdaptiveMtFilesResponse.next_page_token returned from the
|
2049
|
+
# previous call to `ListAdaptiveMtFiles` method. The first page is
|
2050
|
+
# returned if `page_token`is empty or missing.
|
2051
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2052
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2053
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2054
|
+
#
|
2055
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
|
2056
|
+
#
|
2057
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2058
|
+
#
|
2059
|
+
# @example Basic example
|
2060
|
+
# require "google/cloud/translate/v3"
|
2061
|
+
#
|
2062
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2063
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
2064
|
+
#
|
2065
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2066
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
|
2067
|
+
#
|
2068
|
+
# # Call the list_adaptive_mt_files method.
|
2069
|
+
# result = client.list_adaptive_mt_files request
|
2070
|
+
#
|
2071
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2072
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2073
|
+
# result.each do |item|
|
2074
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
|
2075
|
+
# p item
|
2076
|
+
# end
|
2077
|
+
#
|
2078
|
+
def list_adaptive_mt_files request, options = nil
|
2079
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2080
|
+
|
2081
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
|
2082
|
+
|
2083
|
+
# Converts hash and nil to an options object
|
2084
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2085
|
+
|
2086
|
+
# Customize the options with defaults
|
2087
|
+
call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
|
2088
|
+
|
2089
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2090
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2091
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2092
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2093
|
+
transports_version_send: [:rest]
|
2094
|
+
|
2095
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2096
|
+
|
2097
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
|
2098
|
+
metadata: call_metadata,
|
2099
|
+
retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
|
2100
|
+
|
2101
|
+
options.apply_defaults timeout: @config.timeout,
|
2102
|
+
metadata: @config.metadata,
|
2103
|
+
retry_policy: @config.retry_policy
|
2104
|
+
|
2105
|
+
@translation_service_stub.list_adaptive_mt_files request, options do |result, operation|
|
2106
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options
|
2107
|
+
yield result, operation if block_given?
|
2108
|
+
return result
|
2109
|
+
end
|
2110
|
+
rescue ::Gapic::Rest::Error => e
|
2111
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2112
|
+
end
|
2113
|
+
|
2114
|
+
##
|
2115
|
+
# Lists all AdaptiveMtSentences under a given file/dataset.
|
2116
|
+
#
|
2117
|
+
# @overload list_adaptive_mt_sentences(request, options = nil)
|
2118
|
+
# Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
|
2119
|
+
# {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
|
2120
|
+
#
|
2121
|
+
# @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
|
2122
|
+
# A request object representing the call parameters. Required. To specify no
|
2123
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2124
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2125
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
2126
|
+
#
|
2127
|
+
# @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
|
2128
|
+
# Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
|
2129
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2130
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2131
|
+
#
|
2132
|
+
# @param parent [::String]
|
2133
|
+
# Required. The resource name of the project from which to list the Adaptive
|
2134
|
+
# MT files. The following format lists all sentences under a file.
|
2135
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
|
2136
|
+
# The following format lists all sentences within a dataset.
|
2137
|
+
# `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
|
2138
|
+
# @param page_size [::Integer]
|
2139
|
+
# @param page_token [::String]
|
2140
|
+
# A token identifying a page of results the server should return.
|
2141
|
+
# Typically, this is the value of
|
2142
|
+
# ListAdaptiveMtSentencesRequest.next_page_token returned from the
|
2143
|
+
# previous call to `ListTranslationMemories` method. The first page is
|
2144
|
+
# returned if `page_token` is empty or missing.
|
2145
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
2146
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2147
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
2148
|
+
#
|
2149
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
|
2150
|
+
#
|
2151
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
2152
|
+
#
|
2153
|
+
# @example Basic example
|
2154
|
+
# require "google/cloud/translate/v3"
|
2155
|
+
#
|
2156
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2157
|
+
# client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
|
2158
|
+
#
|
2159
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2160
|
+
# request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
|
2161
|
+
#
|
2162
|
+
# # Call the list_adaptive_mt_sentences method.
|
2163
|
+
# result = client.list_adaptive_mt_sentences request
|
2164
|
+
#
|
2165
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
2166
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
2167
|
+
# result.each do |item|
|
2168
|
+
# # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
|
2169
|
+
# p item
|
2170
|
+
# end
|
2171
|
+
#
|
2172
|
+
def list_adaptive_mt_sentences request, options = nil
|
2173
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2174
|
+
|
2175
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
|
2176
|
+
|
2177
|
+
# Converts hash and nil to an options object
|
2178
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2179
|
+
|
2180
|
+
# Customize the options with defaults
|
2181
|
+
call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
|
2182
|
+
|
2183
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2184
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2185
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2186
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION,
|
2187
|
+
transports_version_send: [:rest]
|
2188
|
+
|
2189
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2190
|
+
|
2191
|
+
options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
|
2192
|
+
metadata: call_metadata,
|
2193
|
+
retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
|
2194
|
+
|
2195
|
+
options.apply_defaults timeout: @config.timeout,
|
2196
|
+
metadata: @config.metadata,
|
2197
|
+
retry_policy: @config.retry_policy
|
2198
|
+
|
2199
|
+
@translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation|
|
2200
|
+
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options
|
2201
|
+
yield result, operation if block_given?
|
2202
|
+
return result
|
2203
|
+
end
|
2204
|
+
rescue ::Gapic::Rest::Error => e
|
2205
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2206
|
+
end
|
2207
|
+
|
2208
|
+
##
|
2209
|
+
# Configuration class for the TranslationService REST API.
|
2210
|
+
#
|
2211
|
+
# This class represents the configuration for TranslationService REST,
|
2212
|
+
# providing control over timeouts, retry behavior, logging, transport
|
2213
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
2214
|
+
# applied individually to specific RPCs. See
|
2215
|
+
# {::Google::Cloud::Translate::V3::TranslationService::Rest::Client::Configuration::Rpcs}
|
2216
|
+
# for a list of RPCs that can be configured independently.
|
2217
|
+
#
|
2218
|
+
# Configuration can be applied globally to all clients, or to a single client
|
2219
|
+
# on construction.
|
2220
|
+
#
|
2221
|
+
# @example
|
2222
|
+
#
|
2223
|
+
# # Modify the global config, setting the timeout for
|
2224
|
+
# # translate_text to 20 seconds,
|
2225
|
+
# # and all remaining timeouts to 10 seconds.
|
2226
|
+
# ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config|
|
2227
|
+
# config.timeout = 10.0
|
2228
|
+
# config.rpcs.translate_text.timeout = 20.0
|
2229
|
+
# end
|
2230
|
+
#
|
2231
|
+
# # Apply the above configuration only to a new client.
|
2232
|
+
# client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config|
|
2233
|
+
# config.timeout = 10.0
|
2234
|
+
# config.rpcs.translate_text.timeout = 20.0
|
2235
|
+
# end
|
2236
|
+
#
|
2237
|
+
# @!attribute [rw] endpoint
|
2238
|
+
# The hostname or hostname:port of the service endpoint.
|
2239
|
+
# Defaults to `"translate.googleapis.com"`.
|
2240
|
+
# @return [::String]
|
2241
|
+
# @!attribute [rw] credentials
|
2242
|
+
# Credentials to send with calls. You may provide any of the following types:
|
2243
|
+
# * (`String`) The path to a service account key file in JSON format
|
2244
|
+
# * (`Hash`) A service account key as a Hash
|
2245
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
2246
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
2247
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
2248
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
2249
|
+
# * (`nil`) indicating no credentials
|
2250
|
+
# @return [::Object]
|
2251
|
+
# @!attribute [rw] scope
|
2252
|
+
# The OAuth scopes
|
2253
|
+
# @return [::Array<::String>]
|
2254
|
+
# @!attribute [rw] lib_name
|
2255
|
+
# The library name as recorded in instrumentation and logging
|
2256
|
+
# @return [::String]
|
2257
|
+
# @!attribute [rw] lib_version
|
2258
|
+
# The library version as recorded in instrumentation and logging
|
2259
|
+
# @return [::String]
|
2260
|
+
# @!attribute [rw] timeout
|
2261
|
+
# The call timeout in seconds.
|
2262
|
+
# @return [::Numeric]
|
2263
|
+
# @!attribute [rw] metadata
|
2264
|
+
# Additional headers to be sent with the call.
|
2265
|
+
# @return [::Hash{::Symbol=>::String}]
|
2266
|
+
# @!attribute [rw] retry_policy
|
2267
|
+
# The retry policy. The value is a hash with the following keys:
|
2268
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
2269
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
2270
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
2271
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
2272
|
+
# trigger a retry.
|
2273
|
+
# @return [::Hash]
|
2274
|
+
# @!attribute [rw] quota_project
|
2275
|
+
# A separate project against which to charge quota.
|
2276
|
+
# @return [::String]
|
2277
|
+
#
|
2278
|
+
class Configuration
|
2279
|
+
extend ::Gapic::Config
|
2280
|
+
|
2281
|
+
DEFAULT_ENDPOINT = "translate.googleapis.com"
|
2282
|
+
|
2283
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
2284
|
+
config_attr :credentials, nil do |value|
|
2285
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
2286
|
+
allowed.any? { |klass| klass === value }
|
2287
|
+
end
|
2288
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
2289
|
+
config_attr :lib_name, nil, ::String, nil
|
2290
|
+
config_attr :lib_version, nil, ::String, nil
|
2291
|
+
config_attr :timeout, nil, ::Numeric, nil
|
2292
|
+
config_attr :metadata, nil, ::Hash, nil
|
2293
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
2294
|
+
config_attr :quota_project, nil, ::String, nil
|
2295
|
+
|
2296
|
+
# @private
|
2297
|
+
def initialize parent_config = nil
|
2298
|
+
@parent_config = parent_config unless parent_config.nil?
|
2299
|
+
|
2300
|
+
yield self if block_given?
|
2301
|
+
end
|
2302
|
+
|
2303
|
+
##
|
2304
|
+
# Configurations for individual RPCs
|
2305
|
+
# @return [Rpcs]
|
2306
|
+
#
|
2307
|
+
def rpcs
|
2308
|
+
@rpcs ||= begin
|
2309
|
+
parent_rpcs = nil
|
2310
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
2311
|
+
Rpcs.new parent_rpcs
|
2312
|
+
end
|
2313
|
+
end
|
2314
|
+
|
2315
|
+
##
|
2316
|
+
# Configuration RPC class for the TranslationService API.
|
2317
|
+
#
|
2318
|
+
# Includes fields providing the configuration for each RPC in this service.
|
2319
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
2320
|
+
# the following configuration fields:
|
2321
|
+
#
|
2322
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
2323
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
2324
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
2325
|
+
# include the following keys:
|
2326
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1284
2327
|
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1285
2328
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1286
2329
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
@@ -1337,6 +2380,56 @@ module Google
|
|
1337
2380
|
# @return [::Gapic::Config::Method]
|
1338
2381
|
#
|
1339
2382
|
attr_reader :delete_glossary
|
2383
|
+
##
|
2384
|
+
# RPC-specific configuration for `create_adaptive_mt_dataset`
|
2385
|
+
# @return [::Gapic::Config::Method]
|
2386
|
+
#
|
2387
|
+
attr_reader :create_adaptive_mt_dataset
|
2388
|
+
##
|
2389
|
+
# RPC-specific configuration for `delete_adaptive_mt_dataset`
|
2390
|
+
# @return [::Gapic::Config::Method]
|
2391
|
+
#
|
2392
|
+
attr_reader :delete_adaptive_mt_dataset
|
2393
|
+
##
|
2394
|
+
# RPC-specific configuration for `get_adaptive_mt_dataset`
|
2395
|
+
# @return [::Gapic::Config::Method]
|
2396
|
+
#
|
2397
|
+
attr_reader :get_adaptive_mt_dataset
|
2398
|
+
##
|
2399
|
+
# RPC-specific configuration for `list_adaptive_mt_datasets`
|
2400
|
+
# @return [::Gapic::Config::Method]
|
2401
|
+
#
|
2402
|
+
attr_reader :list_adaptive_mt_datasets
|
2403
|
+
##
|
2404
|
+
# RPC-specific configuration for `adaptive_mt_translate`
|
2405
|
+
# @return [::Gapic::Config::Method]
|
2406
|
+
#
|
2407
|
+
attr_reader :adaptive_mt_translate
|
2408
|
+
##
|
2409
|
+
# RPC-specific configuration for `get_adaptive_mt_file`
|
2410
|
+
# @return [::Gapic::Config::Method]
|
2411
|
+
#
|
2412
|
+
attr_reader :get_adaptive_mt_file
|
2413
|
+
##
|
2414
|
+
# RPC-specific configuration for `delete_adaptive_mt_file`
|
2415
|
+
# @return [::Gapic::Config::Method]
|
2416
|
+
#
|
2417
|
+
attr_reader :delete_adaptive_mt_file
|
2418
|
+
##
|
2419
|
+
# RPC-specific configuration for `import_adaptive_mt_file`
|
2420
|
+
# @return [::Gapic::Config::Method]
|
2421
|
+
#
|
2422
|
+
attr_reader :import_adaptive_mt_file
|
2423
|
+
##
|
2424
|
+
# RPC-specific configuration for `list_adaptive_mt_files`
|
2425
|
+
# @return [::Gapic::Config::Method]
|
2426
|
+
#
|
2427
|
+
attr_reader :list_adaptive_mt_files
|
2428
|
+
##
|
2429
|
+
# RPC-specific configuration for `list_adaptive_mt_sentences`
|
2430
|
+
# @return [::Gapic::Config::Method]
|
2431
|
+
#
|
2432
|
+
attr_reader :list_adaptive_mt_sentences
|
1340
2433
|
|
1341
2434
|
# @private
|
1342
2435
|
def initialize parent_rpcs = nil
|
@@ -1360,6 +2453,26 @@ module Google
|
|
1360
2453
|
@get_glossary = ::Gapic::Config::Method.new get_glossary_config
|
1361
2454
|
delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
|
1362
2455
|
@delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
|
2456
|
+
create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
|
2457
|
+
@create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
|
2458
|
+
delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
|
2459
|
+
@delete_adaptive_mt_dataset = ::Gapic::Config::Method.new delete_adaptive_mt_dataset_config
|
2460
|
+
get_adaptive_mt_dataset_config = parent_rpcs.get_adaptive_mt_dataset if parent_rpcs.respond_to? :get_adaptive_mt_dataset
|
2461
|
+
@get_adaptive_mt_dataset = ::Gapic::Config::Method.new get_adaptive_mt_dataset_config
|
2462
|
+
list_adaptive_mt_datasets_config = parent_rpcs.list_adaptive_mt_datasets if parent_rpcs.respond_to? :list_adaptive_mt_datasets
|
2463
|
+
@list_adaptive_mt_datasets = ::Gapic::Config::Method.new list_adaptive_mt_datasets_config
|
2464
|
+
adaptive_mt_translate_config = parent_rpcs.adaptive_mt_translate if parent_rpcs.respond_to? :adaptive_mt_translate
|
2465
|
+
@adaptive_mt_translate = ::Gapic::Config::Method.new adaptive_mt_translate_config
|
2466
|
+
get_adaptive_mt_file_config = parent_rpcs.get_adaptive_mt_file if parent_rpcs.respond_to? :get_adaptive_mt_file
|
2467
|
+
@get_adaptive_mt_file = ::Gapic::Config::Method.new get_adaptive_mt_file_config
|
2468
|
+
delete_adaptive_mt_file_config = parent_rpcs.delete_adaptive_mt_file if parent_rpcs.respond_to? :delete_adaptive_mt_file
|
2469
|
+
@delete_adaptive_mt_file = ::Gapic::Config::Method.new delete_adaptive_mt_file_config
|
2470
|
+
import_adaptive_mt_file_config = parent_rpcs.import_adaptive_mt_file if parent_rpcs.respond_to? :import_adaptive_mt_file
|
2471
|
+
@import_adaptive_mt_file = ::Gapic::Config::Method.new import_adaptive_mt_file_config
|
2472
|
+
list_adaptive_mt_files_config = parent_rpcs.list_adaptive_mt_files if parent_rpcs.respond_to? :list_adaptive_mt_files
|
2473
|
+
@list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
|
2474
|
+
list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
|
2475
|
+
@list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
|
1363
2476
|
|
1364
2477
|
yield self if block_given?
|
1365
2478
|
end
|