google-cloud-translate-v3 0.12.0 → 1.1.0

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