google-cloud-translate-v3 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,8 @@
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/translate/v3/translation_service_pb"
21
21
  require "google/cloud/translate/v3/translation_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
22
24
 
23
25
  module Google
24
26
  module Cloud
@@ -191,6 +193,21 @@ module Google
191
193
  universe_domain: @config.universe_domain,
192
194
  credentials: credentials
193
195
  )
196
+
197
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
198
+ config.credentials = credentials
199
+ config.quota_project = @quota_project_id
200
+ config.endpoint = @translation_service_stub.endpoint
201
+ config.universe_domain = @translation_service_stub.universe_domain
202
+ config.bindings_override = @config.bindings_override
203
+ end
204
+
205
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
206
+ config.credentials = credentials
207
+ config.quota_project = @quota_project_id
208
+ config.endpoint = @translation_service_stub.endpoint
209
+ config.universe_domain = @translation_service_stub.universe_domain
210
+ end
194
211
  end
195
212
 
196
213
  ##
@@ -200,6 +217,20 @@ module Google
200
217
  #
201
218
  attr_reader :operations_client
202
219
 
220
+ ##
221
+ # Get the associated client for mix-in of the Locations.
222
+ #
223
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
224
+ #
225
+ attr_reader :location_client
226
+
227
+ ##
228
+ # Get the associated client for mix-in of the IAMPolicy.
229
+ #
230
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
231
+ #
232
+ attr_reader :iam_policy_client
233
+
203
234
  # Service calls
204
235
 
205
236
  ##
@@ -215,7 +246,7 @@ module Google
215
246
  # @param options [::Gapic::CallOptions, ::Hash]
216
247
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
217
248
  #
218
- # @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)
249
+ # @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)
219
250
  # Pass arguments to `translate_text` via keyword arguments. Note that at
220
251
  # least one keyword argument is required. To specify no parameters, or to keep all
221
252
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -262,6 +293,8 @@ module Google
262
293
  # - General (built-in) models:
263
294
  # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
264
295
  #
296
+ # - Translation LLM models:
297
+ # `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
265
298
  #
266
299
  # For global (non-regionalized) requests, use `location-id` `global`.
267
300
  # For example,
@@ -272,6 +305,8 @@ module Google
272
305
  # Optional. Glossary to be applied. The glossary must be
273
306
  # within the same region (have the same location-id) as the model, otherwise
274
307
  # an INVALID_ARGUMENT (400) error is returned.
308
+ # @param transliteration_config [::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash]
309
+ # Optional. Transliteration to be applied.
275
310
  # @param labels [::Hash{::String => ::String}]
276
311
  # Optional. The labels with user-defined metadata for the request.
277
312
  #
@@ -341,6 +376,99 @@ module Google
341
376
  raise ::Google::Cloud::Error.from_error(e)
342
377
  end
343
378
 
379
+ ##
380
+ # Romanize input text written in non-Latin scripts to Latin text.
381
+ #
382
+ # @overload romanize_text(request, options = nil)
383
+ # Pass arguments to `romanize_text` via a request object, either of type
384
+ # {::Google::Cloud::Translate::V3::RomanizeTextRequest} or an equivalent Hash.
385
+ #
386
+ # @param request [::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash]
387
+ # A request object representing the call parameters. Required. To specify no
388
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
389
+ # @param options [::Gapic::CallOptions, ::Hash]
390
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
391
+ #
392
+ # @overload romanize_text(parent: nil, contents: nil, source_language_code: nil)
393
+ # Pass arguments to `romanize_text` via keyword arguments. Note that at
394
+ # least one keyword argument is required. To specify no parameters, or to keep all
395
+ # the default parameter values, pass an empty Hash as a request object (see above).
396
+ #
397
+ # @param parent [::String]
398
+ # Required. Project or location to make a call. Must refer to a caller's
399
+ # project.
400
+ #
401
+ # Format: `projects/{project-number-or-id}/locations/{location-id}` or
402
+ # `projects/{project-number-or-id}`.
403
+ #
404
+ # For global calls, use `projects/{project-number-or-id}/locations/global` or
405
+ # `projects/{project-number-or-id}`.
406
+ # @param contents [::Array<::String>]
407
+ # Required. The content of the input in string format.
408
+ # @param source_language_code [::String]
409
+ # Optional. The ISO-639 language code of the input text if
410
+ # known, for example, "hi" or "zh". If the source language isn't specified,
411
+ # the API attempts to identify the source language automatically and returns
412
+ # the source language for each content in the response.
413
+ # @yield [result, operation] Access the result along with the TransportOperation object
414
+ # @yieldparam result [::Google::Cloud::Translate::V3::RomanizeTextResponse]
415
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
416
+ #
417
+ # @return [::Google::Cloud::Translate::V3::RomanizeTextResponse]
418
+ #
419
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
420
+ #
421
+ # @example Basic example
422
+ # require "google/cloud/translate/v3"
423
+ #
424
+ # # Create a client object. The client can be reused for multiple calls.
425
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
426
+ #
427
+ # # Create a request. To set request fields, pass in keyword arguments.
428
+ # request = Google::Cloud::Translate::V3::RomanizeTextRequest.new
429
+ #
430
+ # # Call the romanize_text method.
431
+ # result = client.romanize_text request
432
+ #
433
+ # # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse.
434
+ # p result
435
+ #
436
+ def romanize_text request, options = nil
437
+ raise ::ArgumentError, "request must be provided" if request.nil?
438
+
439
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::RomanizeTextRequest
440
+
441
+ # Converts hash and nil to an options object
442
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
443
+
444
+ # Customize the options with defaults
445
+ call_metadata = @config.rpcs.romanize_text.metadata.to_h
446
+
447
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
448
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
449
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
450
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
451
+ transports_version_send: [:rest]
452
+
453
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
454
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.romanize_text.timeout,
457
+ metadata: call_metadata,
458
+ retry_policy: @config.rpcs.romanize_text.retry_policy
459
+
460
+ options.apply_defaults timeout: @config.timeout,
461
+ metadata: @config.metadata,
462
+ retry_policy: @config.retry_policy
463
+
464
+ @translation_service_stub.romanize_text request, options do |result, operation|
465
+ yield result, operation if block_given?
466
+ return result
467
+ end
468
+ rescue ::Gapic::Rest::Error => e
469
+ raise ::Google::Cloud::Error.from_error(e)
470
+ end
471
+
344
472
  ##
345
473
  # Detects the language of text within a request.
346
474
  #
@@ -1107,6 +1235,97 @@ module Google
1107
1235
  raise ::Google::Cloud::Error.from_error(e)
1108
1236
  end
1109
1237
 
1238
+ ##
1239
+ # Updates a glossary. A LRO is used since the update can be async if the
1240
+ # glossary's entry file is updated.
1241
+ #
1242
+ # @overload update_glossary(request, options = nil)
1243
+ # Pass arguments to `update_glossary` via a request object, either of type
1244
+ # {::Google::Cloud::Translate::V3::UpdateGlossaryRequest} or an equivalent Hash.
1245
+ #
1246
+ # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash]
1247
+ # A request object representing the call parameters. Required. To specify no
1248
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1249
+ # @param options [::Gapic::CallOptions, ::Hash]
1250
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1251
+ #
1252
+ # @overload update_glossary(glossary: nil, update_mask: nil)
1253
+ # Pass arguments to `update_glossary` via keyword arguments. Note that at
1254
+ # least one keyword argument is required. To specify no parameters, or to keep all
1255
+ # the default parameter values, pass an empty Hash as a request object (see above).
1256
+ #
1257
+ # @param glossary [::Google::Cloud::Translate::V3::Glossary, ::Hash]
1258
+ # Required. The glossary entry to update.
1259
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1260
+ # The list of fields to be updated. Currently only `display_name` and
1261
+ # 'input_config'
1262
+ # @yield [result, operation] Access the result along with the TransportOperation object
1263
+ # @yieldparam result [::Gapic::Operation]
1264
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1265
+ #
1266
+ # @return [::Gapic::Operation]
1267
+ #
1268
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1269
+ #
1270
+ # @example Basic example
1271
+ # require "google/cloud/translate/v3"
1272
+ #
1273
+ # # Create a client object. The client can be reused for multiple calls.
1274
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1275
+ #
1276
+ # # Create a request. To set request fields, pass in keyword arguments.
1277
+ # request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new
1278
+ #
1279
+ # # Call the update_glossary method.
1280
+ # result = client.update_glossary request
1281
+ #
1282
+ # # The returned object is of type Gapic::Operation. You can use it to
1283
+ # # check the status of an operation, cancel it, or wait for results.
1284
+ # # Here is how to wait for a response.
1285
+ # result.wait_until_done! timeout: 60
1286
+ # if result.response?
1287
+ # p result.response
1288
+ # else
1289
+ # puts "No response received."
1290
+ # end
1291
+ #
1292
+ def update_glossary request, options = nil
1293
+ raise ::ArgumentError, "request must be provided" if request.nil?
1294
+
1295
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryRequest
1296
+
1297
+ # Converts hash and nil to an options object
1298
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1299
+
1300
+ # Customize the options with defaults
1301
+ call_metadata = @config.rpcs.update_glossary.metadata.to_h
1302
+
1303
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1304
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1305
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1306
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
1307
+ transports_version_send: [:rest]
1308
+
1309
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1310
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1311
+
1312
+ options.apply_defaults timeout: @config.rpcs.update_glossary.timeout,
1313
+ metadata: call_metadata,
1314
+ retry_policy: @config.rpcs.update_glossary.retry_policy
1315
+
1316
+ options.apply_defaults timeout: @config.timeout,
1317
+ metadata: @config.metadata,
1318
+ retry_policy: @config.retry_policy
1319
+
1320
+ @translation_service_stub.update_glossary request, options do |result, operation|
1321
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1322
+ yield result, operation if block_given?
1323
+ return result
1324
+ end
1325
+ rescue ::Gapic::Rest::Error => e
1326
+ raise ::Google::Cloud::Error.from_error(e)
1327
+ end
1328
+
1110
1329
  ##
1111
1330
  # Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
1112
1331
  # exist.
@@ -1387,33 +1606,30 @@ module Google
1387
1606
  end
1388
1607
 
1389
1608
  ##
1390
- # Creates an Adaptive MT dataset.
1609
+ # Gets a single glossary entry by the given id.
1391
1610
  #
1392
- # @overload create_adaptive_mt_dataset(request, options = nil)
1393
- # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
1394
- # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
1611
+ # @overload get_glossary_entry(request, options = nil)
1612
+ # Pass arguments to `get_glossary_entry` via a request object, either of type
1613
+ # {::Google::Cloud::Translate::V3::GetGlossaryEntryRequest} or an equivalent Hash.
1395
1614
  #
1396
- # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
1615
+ # @param request [::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash]
1397
1616
  # A request object representing the call parameters. Required. To specify no
1398
1617
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1399
1618
  # @param options [::Gapic::CallOptions, ::Hash]
1400
1619
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1401
1620
  #
1402
- # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
1403
- # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
1621
+ # @overload get_glossary_entry(name: nil)
1622
+ # Pass arguments to `get_glossary_entry` via keyword arguments. Note that at
1404
1623
  # least one keyword argument is required. To specify no parameters, or to keep all
1405
1624
  # the default parameter values, pass an empty Hash as a request object (see above).
1406
1625
  #
1407
- # @param parent [::String]
1408
- # Required. Name of the parent project. In form of
1409
- # `projects/{project-number-or-id}/locations/{location-id}`
1410
- # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
1411
- # Required. The AdaptiveMtDataset to be created.
1626
+ # @param name [::String]
1627
+ # Required. The resource name of the glossary entry to get
1412
1628
  # @yield [result, operation] Access the result along with the TransportOperation object
1413
- # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
1629
+ # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry]
1414
1630
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1415
1631
  #
1416
- # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
1632
+ # @return [::Google::Cloud::Translate::V3::GlossaryEntry]
1417
1633
  #
1418
1634
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1419
1635
  #
@@ -1424,24 +1640,24 @@ module Google
1424
1640
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1425
1641
  #
1426
1642
  # # Create a request. To set request fields, pass in keyword arguments.
1427
- # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
1643
+ # request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new
1428
1644
  #
1429
- # # Call the create_adaptive_mt_dataset method.
1430
- # result = client.create_adaptive_mt_dataset request
1645
+ # # Call the get_glossary_entry method.
1646
+ # result = client.get_glossary_entry request
1431
1647
  #
1432
- # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
1648
+ # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
1433
1649
  # p result
1434
1650
  #
1435
- def create_adaptive_mt_dataset request, options = nil
1651
+ def get_glossary_entry request, options = nil
1436
1652
  raise ::ArgumentError, "request must be provided" if request.nil?
1437
1653
 
1438
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
1654
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetGlossaryEntryRequest
1439
1655
 
1440
1656
  # Converts hash and nil to an options object
1441
1657
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1442
1658
 
1443
1659
  # Customize the options with defaults
1444
- call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
1660
+ call_metadata = @config.rpcs.get_glossary_entry.metadata.to_h
1445
1661
 
1446
1662
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1447
1663
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1452,15 +1668,15 @@ module Google
1452
1668
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1453
1669
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1454
1670
 
1455
- options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
1671
+ options.apply_defaults timeout: @config.rpcs.get_glossary_entry.timeout,
1456
1672
  metadata: call_metadata,
1457
- retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
1673
+ retry_policy: @config.rpcs.get_glossary_entry.retry_policy
1458
1674
 
1459
1675
  options.apply_defaults timeout: @config.timeout,
1460
1676
  metadata: @config.metadata,
1461
1677
  retry_policy: @config.retry_policy
1462
1678
 
1463
- @translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation|
1679
+ @translation_service_stub.get_glossary_entry request, options do |result, operation|
1464
1680
  yield result, operation if block_given?
1465
1681
  return result
1466
1682
  end
@@ -1469,32 +1685,39 @@ module Google
1469
1685
  end
1470
1686
 
1471
1687
  ##
1472
- # Deletes an Adaptive MT dataset, including all its entries and associated
1473
- # metadata.
1688
+ # List the entries for the glossary.
1474
1689
  #
1475
- # @overload delete_adaptive_mt_dataset(request, options = nil)
1476
- # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
1477
- # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
1690
+ # @overload list_glossary_entries(request, options = nil)
1691
+ # Pass arguments to `list_glossary_entries` via a request object, either of type
1692
+ # {::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest} or an equivalent Hash.
1478
1693
  #
1479
- # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
1694
+ # @param request [::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash]
1480
1695
  # A request object representing the call parameters. Required. To specify no
1481
1696
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1482
1697
  # @param options [::Gapic::CallOptions, ::Hash]
1483
1698
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1484
1699
  #
1485
- # @overload delete_adaptive_mt_dataset(name: nil)
1486
- # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
1700
+ # @overload list_glossary_entries(parent: nil, page_size: nil, page_token: nil)
1701
+ # Pass arguments to `list_glossary_entries` via keyword arguments. Note that at
1487
1702
  # least one keyword argument is required. To specify no parameters, or to keep all
1488
1703
  # the default parameter values, pass an empty Hash as a request object (see above).
1489
1704
  #
1490
- # @param name [::String]
1491
- # Required. Name of the dataset. In the form of
1492
- # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
1705
+ # @param parent [::String]
1706
+ # Required. The parent glossary resource name for listing the glossary's
1707
+ # entries.
1708
+ # @param page_size [::Integer]
1709
+ # Optional. Requested page size. The server may return fewer glossary entries
1710
+ # than requested. If unspecified, the server picks an appropriate default.
1711
+ # @param page_token [::String]
1712
+ # Optional. A token identifying a page of results the server should return.
1713
+ # Typically, this is the value of
1714
+ # [ListGlossaryEntriesResponse.next_page_token] returned from the previous
1715
+ # call. The first page is returned if `page_token`is empty or missing.
1493
1716
  # @yield [result, operation] Access the result along with the TransportOperation object
1494
- # @yieldparam result [::Google::Protobuf::Empty]
1717
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>]
1495
1718
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1496
1719
  #
1497
- # @return [::Google::Protobuf::Empty]
1720
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>]
1498
1721
  #
1499
1722
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1500
1723
  #
@@ -1505,24 +1728,28 @@ module Google
1505
1728
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1506
1729
  #
1507
1730
  # # Create a request. To set request fields, pass in keyword arguments.
1508
- # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
1731
+ # request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new
1509
1732
  #
1510
- # # Call the delete_adaptive_mt_dataset method.
1511
- # result = client.delete_adaptive_mt_dataset request
1733
+ # # Call the list_glossary_entries method.
1734
+ # result = client.list_glossary_entries request
1512
1735
  #
1513
- # # The returned object is of type Google::Protobuf::Empty.
1514
- # p result
1736
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1737
+ # # over elements, and API calls will be issued to fetch pages as needed.
1738
+ # result.each do |item|
1739
+ # # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry.
1740
+ # p item
1741
+ # end
1515
1742
  #
1516
- def delete_adaptive_mt_dataset request, options = nil
1743
+ def list_glossary_entries request, options = nil
1517
1744
  raise ::ArgumentError, "request must be provided" if request.nil?
1518
1745
 
1519
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
1746
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest
1520
1747
 
1521
1748
  # Converts hash and nil to an options object
1522
1749
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1523
1750
 
1524
1751
  # Customize the options with defaults
1525
- call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
1752
+ call_metadata = @config.rpcs.list_glossary_entries.metadata.to_h
1526
1753
 
1527
1754
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1528
1755
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1533,15 +1760,16 @@ module Google
1533
1760
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1534
1761
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1535
1762
 
1536
- options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
1763
+ options.apply_defaults timeout: @config.rpcs.list_glossary_entries.timeout,
1537
1764
  metadata: call_metadata,
1538
- retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
1765
+ retry_policy: @config.rpcs.list_glossary_entries.retry_policy
1539
1766
 
1540
1767
  options.apply_defaults timeout: @config.timeout,
1541
1768
  metadata: @config.metadata,
1542
1769
  retry_policy: @config.retry_policy
1543
1770
 
1544
- @translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation|
1771
+ @translation_service_stub.list_glossary_entries request, options do |result, operation|
1772
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, "glossary_entries", request, result, options
1545
1773
  yield result, operation if block_given?
1546
1774
  return result
1547
1775
  end
@@ -1550,31 +1778,32 @@ module Google
1550
1778
  end
1551
1779
 
1552
1780
  ##
1553
- # Gets the Adaptive MT dataset.
1781
+ # Creates a glossary entry.
1554
1782
  #
1555
- # @overload get_adaptive_mt_dataset(request, options = nil)
1556
- # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
1557
- # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
1783
+ # @overload create_glossary_entry(request, options = nil)
1784
+ # Pass arguments to `create_glossary_entry` via a request object, either of type
1785
+ # {::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest} or an equivalent Hash.
1558
1786
  #
1559
- # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
1787
+ # @param request [::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash]
1560
1788
  # A request object representing the call parameters. Required. To specify no
1561
1789
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1562
1790
  # @param options [::Gapic::CallOptions, ::Hash]
1563
1791
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1564
1792
  #
1565
- # @overload get_adaptive_mt_dataset(name: nil)
1566
- # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
1793
+ # @overload create_glossary_entry(parent: nil, glossary_entry: nil)
1794
+ # Pass arguments to `create_glossary_entry` via keyword arguments. Note that at
1567
1795
  # least one keyword argument is required. To specify no parameters, or to keep all
1568
1796
  # the default parameter values, pass an empty Hash as a request object (see above).
1569
1797
  #
1570
- # @param name [::String]
1571
- # Required. Name of the dataset. In the form of
1572
- # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
1798
+ # @param parent [::String]
1799
+ # Required. The resource name of the glossary to create the entry under.
1800
+ # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash]
1801
+ # Required. The glossary entry to create
1573
1802
  # @yield [result, operation] Access the result along with the TransportOperation object
1574
- # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
1803
+ # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry]
1575
1804
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1576
1805
  #
1577
- # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
1806
+ # @return [::Google::Cloud::Translate::V3::GlossaryEntry]
1578
1807
  #
1579
1808
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1580
1809
  #
@@ -1585,24 +1814,24 @@ module Google
1585
1814
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1586
1815
  #
1587
1816
  # # Create a request. To set request fields, pass in keyword arguments.
1588
- # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
1817
+ # request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new
1589
1818
  #
1590
- # # Call the get_adaptive_mt_dataset method.
1591
- # result = client.get_adaptive_mt_dataset request
1819
+ # # Call the create_glossary_entry method.
1820
+ # result = client.create_glossary_entry request
1592
1821
  #
1593
- # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
1822
+ # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
1594
1823
  # p result
1595
1824
  #
1596
- def get_adaptive_mt_dataset request, options = nil
1825
+ def create_glossary_entry request, options = nil
1597
1826
  raise ::ArgumentError, "request must be provided" if request.nil?
1598
1827
 
1599
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
1828
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest
1600
1829
 
1601
1830
  # Converts hash and nil to an options object
1602
1831
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1603
1832
 
1604
1833
  # Customize the options with defaults
1605
- call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
1834
+ call_metadata = @config.rpcs.create_glossary_entry.metadata.to_h
1606
1835
 
1607
1836
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1608
1837
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1613,15 +1842,15 @@ module Google
1613
1842
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1614
1843
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1615
1844
 
1616
- options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
1845
+ options.apply_defaults timeout: @config.rpcs.create_glossary_entry.timeout,
1617
1846
  metadata: call_metadata,
1618
- retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
1847
+ retry_policy: @config.rpcs.create_glossary_entry.retry_policy
1619
1848
 
1620
1849
  options.apply_defaults timeout: @config.timeout,
1621
1850
  metadata: @config.metadata,
1622
1851
  retry_policy: @config.retry_policy
1623
1852
 
1624
- @translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation|
1853
+ @translation_service_stub.create_glossary_entry request, options do |result, operation|
1625
1854
  yield result, operation if block_given?
1626
1855
  return result
1627
1856
  end
@@ -1630,43 +1859,1222 @@ module Google
1630
1859
  end
1631
1860
 
1632
1861
  ##
1633
- # Lists all Adaptive MT datasets for which the caller has read permission.
1862
+ # Updates a glossary entry.
1634
1863
  #
1635
- # @overload list_adaptive_mt_datasets(request, options = nil)
1636
- # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
1637
- # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
1864
+ # @overload update_glossary_entry(request, options = nil)
1865
+ # Pass arguments to `update_glossary_entry` via a request object, either of type
1866
+ # {::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest} or an equivalent Hash.
1638
1867
  #
1639
- # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash]
1868
+ # @param request [::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash]
1640
1869
  # A request object representing the call parameters. Required. To specify no
1641
1870
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1642
1871
  # @param options [::Gapic::CallOptions, ::Hash]
1643
1872
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1644
1873
  #
1645
- # @overload list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
1646
- # Pass arguments to `list_adaptive_mt_datasets` via keyword arguments. Note that at
1874
+ # @overload update_glossary_entry(glossary_entry: nil)
1875
+ # Pass arguments to `update_glossary_entry` via keyword arguments. Note that at
1647
1876
  # least one keyword argument is required. To specify no parameters, or to keep all
1648
1877
  # the default parameter values, pass an empty Hash as a request object (see above).
1649
1878
  #
1650
- # @param parent [::String]
1651
- # Required. The resource name of the project from which to list the Adaptive
1652
- # MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
1653
- # @param page_size [::Integer]
1654
- # Optional. Requested page size. The server may return fewer results than
1655
- # requested. If unspecified, the server picks an appropriate default.
1656
- # @param page_token [::String]
1657
- # Optional. A token identifying a page of results the server should return.
1658
- # Typically, this is the value of
1659
- # ListAdaptiveMtDatasetsResponse.next_page_token returned from the
1879
+ # @param glossary_entry [::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash]
1880
+ # Required. The glossary entry to update.
1881
+ # @yield [result, operation] Access the result along with the TransportOperation object
1882
+ # @yieldparam result [::Google::Cloud::Translate::V3::GlossaryEntry]
1883
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1884
+ #
1885
+ # @return [::Google::Cloud::Translate::V3::GlossaryEntry]
1886
+ #
1887
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1888
+ #
1889
+ # @example Basic example
1890
+ # require "google/cloud/translate/v3"
1891
+ #
1892
+ # # Create a client object. The client can be reused for multiple calls.
1893
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1894
+ #
1895
+ # # Create a request. To set request fields, pass in keyword arguments.
1896
+ # request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new
1897
+ #
1898
+ # # Call the update_glossary_entry method.
1899
+ # result = client.update_glossary_entry request
1900
+ #
1901
+ # # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry.
1902
+ # p result
1903
+ #
1904
+ def update_glossary_entry request, options = nil
1905
+ raise ::ArgumentError, "request must be provided" if request.nil?
1906
+
1907
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest
1908
+
1909
+ # Converts hash and nil to an options object
1910
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1911
+
1912
+ # Customize the options with defaults
1913
+ call_metadata = @config.rpcs.update_glossary_entry.metadata.to_h
1914
+
1915
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1916
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1917
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1918
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
1919
+ transports_version_send: [:rest]
1920
+
1921
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1922
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1923
+
1924
+ options.apply_defaults timeout: @config.rpcs.update_glossary_entry.timeout,
1925
+ metadata: call_metadata,
1926
+ retry_policy: @config.rpcs.update_glossary_entry.retry_policy
1927
+
1928
+ options.apply_defaults timeout: @config.timeout,
1929
+ metadata: @config.metadata,
1930
+ retry_policy: @config.retry_policy
1931
+
1932
+ @translation_service_stub.update_glossary_entry request, options do |result, operation|
1933
+ yield result, operation if block_given?
1934
+ return result
1935
+ end
1936
+ rescue ::Gapic::Rest::Error => e
1937
+ raise ::Google::Cloud::Error.from_error(e)
1938
+ end
1939
+
1940
+ ##
1941
+ # Deletes a single entry from the glossary
1942
+ #
1943
+ # @overload delete_glossary_entry(request, options = nil)
1944
+ # Pass arguments to `delete_glossary_entry` via a request object, either of type
1945
+ # {::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest} or an equivalent Hash.
1946
+ #
1947
+ # @param request [::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash]
1948
+ # A request object representing the call parameters. Required. To specify no
1949
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1950
+ # @param options [::Gapic::CallOptions, ::Hash]
1951
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1952
+ #
1953
+ # @overload delete_glossary_entry(name: nil)
1954
+ # Pass arguments to `delete_glossary_entry` via keyword arguments. Note that at
1955
+ # least one keyword argument is required. To specify no parameters, or to keep all
1956
+ # the default parameter values, pass an empty Hash as a request object (see above).
1957
+ #
1958
+ # @param name [::String]
1959
+ # Required. The resource name of the glossary entry to delete
1960
+ # @yield [result, operation] Access the result along with the TransportOperation object
1961
+ # @yieldparam result [::Google::Protobuf::Empty]
1962
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1963
+ #
1964
+ # @return [::Google::Protobuf::Empty]
1965
+ #
1966
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1967
+ #
1968
+ # @example Basic example
1969
+ # require "google/cloud/translate/v3"
1970
+ #
1971
+ # # Create a client object. The client can be reused for multiple calls.
1972
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1973
+ #
1974
+ # # Create a request. To set request fields, pass in keyword arguments.
1975
+ # request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new
1976
+ #
1977
+ # # Call the delete_glossary_entry method.
1978
+ # result = client.delete_glossary_entry request
1979
+ #
1980
+ # # The returned object is of type Google::Protobuf::Empty.
1981
+ # p result
1982
+ #
1983
+ def delete_glossary_entry request, options = nil
1984
+ raise ::ArgumentError, "request must be provided" if request.nil?
1985
+
1986
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest
1987
+
1988
+ # Converts hash and nil to an options object
1989
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1990
+
1991
+ # Customize the options with defaults
1992
+ call_metadata = @config.rpcs.delete_glossary_entry.metadata.to_h
1993
+
1994
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1995
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1996
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1997
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
1998
+ transports_version_send: [:rest]
1999
+
2000
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2001
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2002
+
2003
+ options.apply_defaults timeout: @config.rpcs.delete_glossary_entry.timeout,
2004
+ metadata: call_metadata,
2005
+ retry_policy: @config.rpcs.delete_glossary_entry.retry_policy
2006
+
2007
+ options.apply_defaults timeout: @config.timeout,
2008
+ metadata: @config.metadata,
2009
+ retry_policy: @config.retry_policy
2010
+
2011
+ @translation_service_stub.delete_glossary_entry request, options do |result, operation|
2012
+ yield result, operation if block_given?
2013
+ return result
2014
+ end
2015
+ rescue ::Gapic::Rest::Error => e
2016
+ raise ::Google::Cloud::Error.from_error(e)
2017
+ end
2018
+
2019
+ ##
2020
+ # Creates a Dataset.
2021
+ #
2022
+ # @overload create_dataset(request, options = nil)
2023
+ # Pass arguments to `create_dataset` via a request object, either of type
2024
+ # {::Google::Cloud::Translate::V3::CreateDatasetRequest} or an equivalent Hash.
2025
+ #
2026
+ # @param request [::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash]
2027
+ # A request object representing the call parameters. Required. To specify no
2028
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2029
+ # @param options [::Gapic::CallOptions, ::Hash]
2030
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2031
+ #
2032
+ # @overload create_dataset(parent: nil, dataset: nil)
2033
+ # Pass arguments to `create_dataset` via keyword arguments. Note that at
2034
+ # least one keyword argument is required. To specify no parameters, or to keep all
2035
+ # the default parameter values, pass an empty Hash as a request object (see above).
2036
+ #
2037
+ # @param parent [::String]
2038
+ # Required. The project name.
2039
+ # @param dataset [::Google::Cloud::Translate::V3::Dataset, ::Hash]
2040
+ # Required. The Dataset to create.
2041
+ # @yield [result, operation] Access the result along with the TransportOperation object
2042
+ # @yieldparam result [::Gapic::Operation]
2043
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2044
+ #
2045
+ # @return [::Gapic::Operation]
2046
+ #
2047
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2048
+ #
2049
+ # @example Basic example
2050
+ # require "google/cloud/translate/v3"
2051
+ #
2052
+ # # Create a client object. The client can be reused for multiple calls.
2053
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2054
+ #
2055
+ # # Create a request. To set request fields, pass in keyword arguments.
2056
+ # request = Google::Cloud::Translate::V3::CreateDatasetRequest.new
2057
+ #
2058
+ # # Call the create_dataset method.
2059
+ # result = client.create_dataset request
2060
+ #
2061
+ # # The returned object is of type Gapic::Operation. You can use it to
2062
+ # # check the status of an operation, cancel it, or wait for results.
2063
+ # # Here is how to wait for a response.
2064
+ # result.wait_until_done! timeout: 60
2065
+ # if result.response?
2066
+ # p result.response
2067
+ # else
2068
+ # puts "No response received."
2069
+ # end
2070
+ #
2071
+ def create_dataset request, options = nil
2072
+ raise ::ArgumentError, "request must be provided" if request.nil?
2073
+
2074
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateDatasetRequest
2075
+
2076
+ # Converts hash and nil to an options object
2077
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2078
+
2079
+ # Customize the options with defaults
2080
+ call_metadata = @config.rpcs.create_dataset.metadata.to_h
2081
+
2082
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2083
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2084
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2085
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2086
+ transports_version_send: [:rest]
2087
+
2088
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2089
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2090
+
2091
+ options.apply_defaults timeout: @config.rpcs.create_dataset.timeout,
2092
+ metadata: call_metadata,
2093
+ retry_policy: @config.rpcs.create_dataset.retry_policy
2094
+
2095
+ options.apply_defaults timeout: @config.timeout,
2096
+ metadata: @config.metadata,
2097
+ retry_policy: @config.retry_policy
2098
+
2099
+ @translation_service_stub.create_dataset request, options do |result, operation|
2100
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2101
+ yield result, operation if block_given?
2102
+ return result
2103
+ end
2104
+ rescue ::Gapic::Rest::Error => e
2105
+ raise ::Google::Cloud::Error.from_error(e)
2106
+ end
2107
+
2108
+ ##
2109
+ # Gets a Dataset.
2110
+ #
2111
+ # @overload get_dataset(request, options = nil)
2112
+ # Pass arguments to `get_dataset` via a request object, either of type
2113
+ # {::Google::Cloud::Translate::V3::GetDatasetRequest} or an equivalent Hash.
2114
+ #
2115
+ # @param request [::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash]
2116
+ # A request object representing the call parameters. Required. To specify no
2117
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2118
+ # @param options [::Gapic::CallOptions, ::Hash]
2119
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2120
+ #
2121
+ # @overload get_dataset(name: nil)
2122
+ # Pass arguments to `get_dataset` via keyword arguments. Note that at
2123
+ # least one keyword argument is required. To specify no parameters, or to keep all
2124
+ # the default parameter values, pass an empty Hash as a request object (see above).
2125
+ #
2126
+ # @param name [::String]
2127
+ # Required. The resource name of the dataset to retrieve.
2128
+ # @yield [result, operation] Access the result along with the TransportOperation object
2129
+ # @yieldparam result [::Google::Cloud::Translate::V3::Dataset]
2130
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2131
+ #
2132
+ # @return [::Google::Cloud::Translate::V3::Dataset]
2133
+ #
2134
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2135
+ #
2136
+ # @example Basic example
2137
+ # require "google/cloud/translate/v3"
2138
+ #
2139
+ # # Create a client object. The client can be reused for multiple calls.
2140
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2141
+ #
2142
+ # # Create a request. To set request fields, pass in keyword arguments.
2143
+ # request = Google::Cloud::Translate::V3::GetDatasetRequest.new
2144
+ #
2145
+ # # Call the get_dataset method.
2146
+ # result = client.get_dataset request
2147
+ #
2148
+ # # The returned object is of type Google::Cloud::Translate::V3::Dataset.
2149
+ # p result
2150
+ #
2151
+ def get_dataset request, options = nil
2152
+ raise ::ArgumentError, "request must be provided" if request.nil?
2153
+
2154
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetDatasetRequest
2155
+
2156
+ # Converts hash and nil to an options object
2157
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2158
+
2159
+ # Customize the options with defaults
2160
+ call_metadata = @config.rpcs.get_dataset.metadata.to_h
2161
+
2162
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2163
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2164
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2165
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2166
+ transports_version_send: [:rest]
2167
+
2168
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2169
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2170
+
2171
+ options.apply_defaults timeout: @config.rpcs.get_dataset.timeout,
2172
+ metadata: call_metadata,
2173
+ retry_policy: @config.rpcs.get_dataset.retry_policy
2174
+
2175
+ options.apply_defaults timeout: @config.timeout,
2176
+ metadata: @config.metadata,
2177
+ retry_policy: @config.retry_policy
2178
+
2179
+ @translation_service_stub.get_dataset request, options do |result, operation|
2180
+ yield result, operation if block_given?
2181
+ return result
2182
+ end
2183
+ rescue ::Gapic::Rest::Error => e
2184
+ raise ::Google::Cloud::Error.from_error(e)
2185
+ end
2186
+
2187
+ ##
2188
+ # Lists datasets.
2189
+ #
2190
+ # @overload list_datasets(request, options = nil)
2191
+ # Pass arguments to `list_datasets` via a request object, either of type
2192
+ # {::Google::Cloud::Translate::V3::ListDatasetsRequest} or an equivalent Hash.
2193
+ #
2194
+ # @param request [::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash]
2195
+ # A request object representing the call parameters. Required. To specify no
2196
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2197
+ # @param options [::Gapic::CallOptions, ::Hash]
2198
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2199
+ #
2200
+ # @overload list_datasets(parent: nil, page_size: nil, page_token: nil)
2201
+ # Pass arguments to `list_datasets` via keyword arguments. Note that at
2202
+ # least one keyword argument is required. To specify no parameters, or to keep all
2203
+ # the default parameter values, pass an empty Hash as a request object (see above).
2204
+ #
2205
+ # @param parent [::String]
2206
+ # Required. Name of the parent project. In form of
2207
+ # `projects/{project-number-or-id}/locations/{location-id}`
2208
+ # @param page_size [::Integer]
2209
+ # Optional. Requested page size. The server can return fewer results than
2210
+ # requested.
2211
+ # @param page_token [::String]
2212
+ # Optional. A token identifying a page of results for the server to return.
2213
+ # Typically obtained from next_page_token field in the response of a
2214
+ # ListDatasets call.
2215
+ # @yield [result, operation] Access the result along with the TransportOperation object
2216
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>]
2217
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2218
+ #
2219
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>]
2220
+ #
2221
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2222
+ #
2223
+ # @example Basic example
2224
+ # require "google/cloud/translate/v3"
2225
+ #
2226
+ # # Create a client object. The client can be reused for multiple calls.
2227
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2228
+ #
2229
+ # # Create a request. To set request fields, pass in keyword arguments.
2230
+ # request = Google::Cloud::Translate::V3::ListDatasetsRequest.new
2231
+ #
2232
+ # # Call the list_datasets method.
2233
+ # result = client.list_datasets request
2234
+ #
2235
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2236
+ # # over elements, and API calls will be issued to fetch pages as needed.
2237
+ # result.each do |item|
2238
+ # # Each element is of type ::Google::Cloud::Translate::V3::Dataset.
2239
+ # p item
2240
+ # end
2241
+ #
2242
+ def list_datasets request, options = nil
2243
+ raise ::ArgumentError, "request must be provided" if request.nil?
2244
+
2245
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListDatasetsRequest
2246
+
2247
+ # Converts hash and nil to an options object
2248
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2249
+
2250
+ # Customize the options with defaults
2251
+ call_metadata = @config.rpcs.list_datasets.metadata.to_h
2252
+
2253
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2254
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2255
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2256
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2257
+ transports_version_send: [:rest]
2258
+
2259
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2260
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2261
+
2262
+ options.apply_defaults timeout: @config.rpcs.list_datasets.timeout,
2263
+ metadata: call_metadata,
2264
+ retry_policy: @config.rpcs.list_datasets.retry_policy
2265
+
2266
+ options.apply_defaults timeout: @config.timeout,
2267
+ metadata: @config.metadata,
2268
+ retry_policy: @config.retry_policy
2269
+
2270
+ @translation_service_stub.list_datasets request, options do |result, operation|
2271
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_datasets, "datasets", request, result, options
2272
+ yield result, operation if block_given?
2273
+ return result
2274
+ end
2275
+ rescue ::Gapic::Rest::Error => e
2276
+ raise ::Google::Cloud::Error.from_error(e)
2277
+ end
2278
+
2279
+ ##
2280
+ # Deletes a dataset and all of its contents.
2281
+ #
2282
+ # @overload delete_dataset(request, options = nil)
2283
+ # Pass arguments to `delete_dataset` via a request object, either of type
2284
+ # {::Google::Cloud::Translate::V3::DeleteDatasetRequest} or an equivalent Hash.
2285
+ #
2286
+ # @param request [::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash]
2287
+ # A request object representing the call parameters. Required. To specify no
2288
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2289
+ # @param options [::Gapic::CallOptions, ::Hash]
2290
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2291
+ #
2292
+ # @overload delete_dataset(name: nil)
2293
+ # Pass arguments to `delete_dataset` via keyword arguments. Note that at
2294
+ # least one keyword argument is required. To specify no parameters, or to keep all
2295
+ # the default parameter values, pass an empty Hash as a request object (see above).
2296
+ #
2297
+ # @param name [::String]
2298
+ # Required. The name of the dataset to delete.
2299
+ # @yield [result, operation] Access the result along with the TransportOperation object
2300
+ # @yieldparam result [::Gapic::Operation]
2301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2302
+ #
2303
+ # @return [::Gapic::Operation]
2304
+ #
2305
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2306
+ #
2307
+ # @example Basic example
2308
+ # require "google/cloud/translate/v3"
2309
+ #
2310
+ # # Create a client object. The client can be reused for multiple calls.
2311
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2312
+ #
2313
+ # # Create a request. To set request fields, pass in keyword arguments.
2314
+ # request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new
2315
+ #
2316
+ # # Call the delete_dataset method.
2317
+ # result = client.delete_dataset request
2318
+ #
2319
+ # # The returned object is of type Gapic::Operation. You can use it to
2320
+ # # check the status of an operation, cancel it, or wait for results.
2321
+ # # Here is how to wait for a response.
2322
+ # result.wait_until_done! timeout: 60
2323
+ # if result.response?
2324
+ # p result.response
2325
+ # else
2326
+ # puts "No response received."
2327
+ # end
2328
+ #
2329
+ def delete_dataset request, options = nil
2330
+ raise ::ArgumentError, "request must be provided" if request.nil?
2331
+
2332
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteDatasetRequest
2333
+
2334
+ # Converts hash and nil to an options object
2335
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2336
+
2337
+ # Customize the options with defaults
2338
+ call_metadata = @config.rpcs.delete_dataset.metadata.to_h
2339
+
2340
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2341
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2342
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2343
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2344
+ transports_version_send: [:rest]
2345
+
2346
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2348
+
2349
+ options.apply_defaults timeout: @config.rpcs.delete_dataset.timeout,
2350
+ metadata: call_metadata,
2351
+ retry_policy: @config.rpcs.delete_dataset.retry_policy
2352
+
2353
+ options.apply_defaults timeout: @config.timeout,
2354
+ metadata: @config.metadata,
2355
+ retry_policy: @config.retry_policy
2356
+
2357
+ @translation_service_stub.delete_dataset request, options do |result, operation|
2358
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2359
+ yield result, operation if block_given?
2360
+ return result
2361
+ end
2362
+ rescue ::Gapic::Rest::Error => e
2363
+ raise ::Google::Cloud::Error.from_error(e)
2364
+ end
2365
+
2366
+ ##
2367
+ # Creates an Adaptive MT dataset.
2368
+ #
2369
+ # @overload create_adaptive_mt_dataset(request, options = nil)
2370
+ # Pass arguments to `create_adaptive_mt_dataset` via a request object, either of type
2371
+ # {::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest} or an equivalent Hash.
2372
+ #
2373
+ # @param request [::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash]
2374
+ # A request object representing the call parameters. Required. To specify no
2375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2376
+ # @param options [::Gapic::CallOptions, ::Hash]
2377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2378
+ #
2379
+ # @overload create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil)
2380
+ # Pass arguments to `create_adaptive_mt_dataset` via keyword arguments. Note that at
2381
+ # least one keyword argument is required. To specify no parameters, or to keep all
2382
+ # the default parameter values, pass an empty Hash as a request object (see above).
2383
+ #
2384
+ # @param parent [::String]
2385
+ # Required. Name of the parent project. In form of
2386
+ # `projects/{project-number-or-id}/locations/{location-id}`
2387
+ # @param adaptive_mt_dataset [::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash]
2388
+ # Required. The AdaptiveMtDataset to be created.
2389
+ # @yield [result, operation] Access the result along with the TransportOperation object
2390
+ # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
2391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2392
+ #
2393
+ # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
2394
+ #
2395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2396
+ #
2397
+ # @example Basic example
2398
+ # require "google/cloud/translate/v3"
2399
+ #
2400
+ # # Create a client object. The client can be reused for multiple calls.
2401
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2402
+ #
2403
+ # # Create a request. To set request fields, pass in keyword arguments.
2404
+ # request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new
2405
+ #
2406
+ # # Call the create_adaptive_mt_dataset method.
2407
+ # result = client.create_adaptive_mt_dataset request
2408
+ #
2409
+ # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
2410
+ # p result
2411
+ #
2412
+ def create_adaptive_mt_dataset request, options = nil
2413
+ raise ::ArgumentError, "request must be provided" if request.nil?
2414
+
2415
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest
2416
+
2417
+ # Converts hash and nil to an options object
2418
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2419
+
2420
+ # Customize the options with defaults
2421
+ call_metadata = @config.rpcs.create_adaptive_mt_dataset.metadata.to_h
2422
+
2423
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2424
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2425
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2426
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2427
+ transports_version_send: [:rest]
2428
+
2429
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2430
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2431
+
2432
+ options.apply_defaults timeout: @config.rpcs.create_adaptive_mt_dataset.timeout,
2433
+ metadata: call_metadata,
2434
+ retry_policy: @config.rpcs.create_adaptive_mt_dataset.retry_policy
2435
+
2436
+ options.apply_defaults timeout: @config.timeout,
2437
+ metadata: @config.metadata,
2438
+ retry_policy: @config.retry_policy
2439
+
2440
+ @translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation|
2441
+ yield result, operation if block_given?
2442
+ return result
2443
+ end
2444
+ rescue ::Gapic::Rest::Error => e
2445
+ raise ::Google::Cloud::Error.from_error(e)
2446
+ end
2447
+
2448
+ ##
2449
+ # Deletes an Adaptive MT dataset, including all its entries and associated
2450
+ # metadata.
2451
+ #
2452
+ # @overload delete_adaptive_mt_dataset(request, options = nil)
2453
+ # Pass arguments to `delete_adaptive_mt_dataset` via a request object, either of type
2454
+ # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest} or an equivalent Hash.
2455
+ #
2456
+ # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash]
2457
+ # A request object representing the call parameters. Required. To specify no
2458
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2459
+ # @param options [::Gapic::CallOptions, ::Hash]
2460
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2461
+ #
2462
+ # @overload delete_adaptive_mt_dataset(name: nil)
2463
+ # Pass arguments to `delete_adaptive_mt_dataset` via keyword arguments. Note that at
2464
+ # least one keyword argument is required. To specify no parameters, or to keep all
2465
+ # the default parameter values, pass an empty Hash as a request object (see above).
2466
+ #
2467
+ # @param name [::String]
2468
+ # Required. Name of the dataset. In the form of
2469
+ # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
2470
+ # @yield [result, operation] Access the result along with the TransportOperation object
2471
+ # @yieldparam result [::Google::Protobuf::Empty]
2472
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2473
+ #
2474
+ # @return [::Google::Protobuf::Empty]
2475
+ #
2476
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2477
+ #
2478
+ # @example Basic example
2479
+ # require "google/cloud/translate/v3"
2480
+ #
2481
+ # # Create a client object. The client can be reused for multiple calls.
2482
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2483
+ #
2484
+ # # Create a request. To set request fields, pass in keyword arguments.
2485
+ # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new
2486
+ #
2487
+ # # Call the delete_adaptive_mt_dataset method.
2488
+ # result = client.delete_adaptive_mt_dataset request
2489
+ #
2490
+ # # The returned object is of type Google::Protobuf::Empty.
2491
+ # p result
2492
+ #
2493
+ def delete_adaptive_mt_dataset request, options = nil
2494
+ raise ::ArgumentError, "request must be provided" if request.nil?
2495
+
2496
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest
2497
+
2498
+ # Converts hash and nil to an options object
2499
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2500
+
2501
+ # Customize the options with defaults
2502
+ call_metadata = @config.rpcs.delete_adaptive_mt_dataset.metadata.to_h
2503
+
2504
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2505
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2506
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2507
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2508
+ transports_version_send: [:rest]
2509
+
2510
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2511
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2512
+
2513
+ options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_dataset.timeout,
2514
+ metadata: call_metadata,
2515
+ retry_policy: @config.rpcs.delete_adaptive_mt_dataset.retry_policy
2516
+
2517
+ options.apply_defaults timeout: @config.timeout,
2518
+ metadata: @config.metadata,
2519
+ retry_policy: @config.retry_policy
2520
+
2521
+ @translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation|
2522
+ yield result, operation if block_given?
2523
+ return result
2524
+ end
2525
+ rescue ::Gapic::Rest::Error => e
2526
+ raise ::Google::Cloud::Error.from_error(e)
2527
+ end
2528
+
2529
+ ##
2530
+ # Gets the Adaptive MT dataset.
2531
+ #
2532
+ # @overload get_adaptive_mt_dataset(request, options = nil)
2533
+ # Pass arguments to `get_adaptive_mt_dataset` via a request object, either of type
2534
+ # {::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest} or an equivalent Hash.
2535
+ #
2536
+ # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash]
2537
+ # A request object representing the call parameters. Required. To specify no
2538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2539
+ # @param options [::Gapic::CallOptions, ::Hash]
2540
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2541
+ #
2542
+ # @overload get_adaptive_mt_dataset(name: nil)
2543
+ # Pass arguments to `get_adaptive_mt_dataset` via keyword arguments. Note that at
2544
+ # least one keyword argument is required. To specify no parameters, or to keep all
2545
+ # the default parameter values, pass an empty Hash as a request object (see above).
2546
+ #
2547
+ # @param name [::String]
2548
+ # Required. Name of the dataset. In the form of
2549
+ # `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
2550
+ # @yield [result, operation] Access the result along with the TransportOperation object
2551
+ # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
2552
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2553
+ #
2554
+ # @return [::Google::Cloud::Translate::V3::AdaptiveMtDataset]
2555
+ #
2556
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2557
+ #
2558
+ # @example Basic example
2559
+ # require "google/cloud/translate/v3"
2560
+ #
2561
+ # # Create a client object. The client can be reused for multiple calls.
2562
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2563
+ #
2564
+ # # Create a request. To set request fields, pass in keyword arguments.
2565
+ # request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new
2566
+ #
2567
+ # # Call the get_adaptive_mt_dataset method.
2568
+ # result = client.get_adaptive_mt_dataset request
2569
+ #
2570
+ # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset.
2571
+ # p result
2572
+ #
2573
+ def get_adaptive_mt_dataset request, options = nil
2574
+ raise ::ArgumentError, "request must be provided" if request.nil?
2575
+
2576
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest
2577
+
2578
+ # Converts hash and nil to an options object
2579
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2580
+
2581
+ # Customize the options with defaults
2582
+ call_metadata = @config.rpcs.get_adaptive_mt_dataset.metadata.to_h
2583
+
2584
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2585
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2586
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2587
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2588
+ transports_version_send: [:rest]
2589
+
2590
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2591
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2592
+
2593
+ options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_dataset.timeout,
2594
+ metadata: call_metadata,
2595
+ retry_policy: @config.rpcs.get_adaptive_mt_dataset.retry_policy
2596
+
2597
+ options.apply_defaults timeout: @config.timeout,
2598
+ metadata: @config.metadata,
2599
+ retry_policy: @config.retry_policy
2600
+
2601
+ @translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation|
2602
+ yield result, operation if block_given?
2603
+ return result
2604
+ end
2605
+ rescue ::Gapic::Rest::Error => e
2606
+ raise ::Google::Cloud::Error.from_error(e)
2607
+ end
2608
+
2609
+ ##
2610
+ # Lists all Adaptive MT datasets for which the caller has read permission.
2611
+ #
2612
+ # @overload list_adaptive_mt_datasets(request, options = nil)
2613
+ # Pass arguments to `list_adaptive_mt_datasets` via a request object, either of type
2614
+ # {::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest} or an equivalent Hash.
2615
+ #
2616
+ # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::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 list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil)
2623
+ # Pass arguments to `list_adaptive_mt_datasets` 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 parent [::String]
2628
+ # Required. The resource name of the project from which to list the Adaptive
2629
+ # MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
2630
+ # @param page_size [::Integer]
2631
+ # Optional. Requested page size. The server may return fewer results than
2632
+ # requested. If unspecified, the server picks an appropriate default.
2633
+ # @param page_token [::String]
2634
+ # Optional. A token identifying a page of results the server should return.
2635
+ # Typically, this is the value of
2636
+ # ListAdaptiveMtDatasetsResponse.next_page_token returned from the
1660
2637
  # previous call to `ListAdaptiveMtDatasets` method. The first page is
1661
2638
  # returned if `page_token`is empty or missing.
1662
- # @param filter [::String]
1663
- # Optional. An expression for filtering the results of the request.
1664
- # Filter is not supported yet.
2639
+ # @param filter [::String]
2640
+ # Optional. An expression for filtering the results of the request.
2641
+ # Filter is not supported yet.
2642
+ # @yield [result, operation] Access the result along with the TransportOperation object
2643
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
2644
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2645
+ #
2646
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
2647
+ #
2648
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2649
+ #
2650
+ # @example Basic example
2651
+ # require "google/cloud/translate/v3"
2652
+ #
2653
+ # # Create a client object. The client can be reused for multiple calls.
2654
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2655
+ #
2656
+ # # Create a request. To set request fields, pass in keyword arguments.
2657
+ # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
2658
+ #
2659
+ # # Call the list_adaptive_mt_datasets method.
2660
+ # result = client.list_adaptive_mt_datasets request
2661
+ #
2662
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2663
+ # # over elements, and API calls will be issued to fetch pages as needed.
2664
+ # result.each do |item|
2665
+ # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
2666
+ # p item
2667
+ # end
2668
+ #
2669
+ def list_adaptive_mt_datasets request, options = nil
2670
+ raise ::ArgumentError, "request must be provided" if request.nil?
2671
+
2672
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
2673
+
2674
+ # Converts hash and nil to an options object
2675
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2676
+
2677
+ # Customize the options with defaults
2678
+ call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
2679
+
2680
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2681
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2682
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2683
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2684
+ transports_version_send: [:rest]
2685
+
2686
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2687
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2688
+
2689
+ options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
2690
+ metadata: call_metadata,
2691
+ retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
2692
+
2693
+ options.apply_defaults timeout: @config.timeout,
2694
+ metadata: @config.metadata,
2695
+ retry_policy: @config.retry_policy
2696
+
2697
+ @translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation|
2698
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options
2699
+ yield result, operation if block_given?
2700
+ return result
2701
+ end
2702
+ rescue ::Gapic::Rest::Error => e
2703
+ raise ::Google::Cloud::Error.from_error(e)
2704
+ end
2705
+
2706
+ ##
2707
+ # Translate text using Adaptive MT.
2708
+ #
2709
+ # @overload adaptive_mt_translate(request, options = nil)
2710
+ # Pass arguments to `adaptive_mt_translate` via a request object, either of type
2711
+ # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
2712
+ #
2713
+ # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
2714
+ # A request object representing the call parameters. Required. To specify no
2715
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2716
+ # @param options [::Gapic::CallOptions, ::Hash]
2717
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2718
+ #
2719
+ # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil)
2720
+ # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
2721
+ # least one keyword argument is required. To specify no parameters, or to keep all
2722
+ # the default parameter values, pass an empty Hash as a request object (see above).
2723
+ #
2724
+ # @param parent [::String]
2725
+ # Required. Location to make a regional call.
2726
+ #
2727
+ # Format: `projects/{project-number-or-id}/locations/{location-id}`.
2728
+ # @param dataset [::String]
2729
+ # Required. The resource name for the dataset to use for adaptive MT.
2730
+ # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
2731
+ # @param content [::Array<::String>]
2732
+ # Required. The content of the input in string format.
2733
+ # @param reference_sentence_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash]
2734
+ # Configuration for caller provided reference sentences.
2735
+ # @param glossary_config [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash]
2736
+ # Optional. Glossary to be applied. The glossary must be
2737
+ # within the same region (have the same location-id) as the model, otherwise
2738
+ # an INVALID_ARGUMENT (400) error is returned.
2739
+ # @yield [result, operation] Access the result along with the TransportOperation object
2740
+ # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
2741
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2742
+ #
2743
+ # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
2744
+ #
2745
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2746
+ #
2747
+ # @example Basic example
2748
+ # require "google/cloud/translate/v3"
2749
+ #
2750
+ # # Create a client object. The client can be reused for multiple calls.
2751
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2752
+ #
2753
+ # # Create a request. To set request fields, pass in keyword arguments.
2754
+ # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
2755
+ #
2756
+ # # Call the adaptive_mt_translate method.
2757
+ # result = client.adaptive_mt_translate request
2758
+ #
2759
+ # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
2760
+ # p result
2761
+ #
2762
+ def adaptive_mt_translate request, options = nil
2763
+ raise ::ArgumentError, "request must be provided" if request.nil?
2764
+
2765
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
2766
+
2767
+ # Converts hash and nil to an options object
2768
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2769
+
2770
+ # Customize the options with defaults
2771
+ call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
2772
+
2773
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2774
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2775
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2776
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2777
+ transports_version_send: [:rest]
2778
+
2779
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2780
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2781
+
2782
+ options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
2783
+ metadata: call_metadata,
2784
+ retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
2785
+
2786
+ options.apply_defaults timeout: @config.timeout,
2787
+ metadata: @config.metadata,
2788
+ retry_policy: @config.retry_policy
2789
+
2790
+ @translation_service_stub.adaptive_mt_translate request, options do |result, operation|
2791
+ yield result, operation if block_given?
2792
+ return result
2793
+ end
2794
+ rescue ::Gapic::Rest::Error => e
2795
+ raise ::Google::Cloud::Error.from_error(e)
2796
+ end
2797
+
2798
+ ##
2799
+ # Gets and AdaptiveMtFile
2800
+ #
2801
+ # @overload get_adaptive_mt_file(request, options = nil)
2802
+ # Pass arguments to `get_adaptive_mt_file` via a request object, either of type
2803
+ # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
2804
+ #
2805
+ # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
2806
+ # A request object representing the call parameters. Required. To specify no
2807
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2808
+ # @param options [::Gapic::CallOptions, ::Hash]
2809
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2810
+ #
2811
+ # @overload get_adaptive_mt_file(name: nil)
2812
+ # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
2813
+ # least one keyword argument is required. To specify no parameters, or to keep all
2814
+ # the default parameter values, pass an empty Hash as a request object (see above).
2815
+ #
2816
+ # @param name [::String]
2817
+ # Required. The resource name of the file, in form of
2818
+ # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
2819
+ # @yield [result, operation] Access the result along with the TransportOperation object
2820
+ # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile]
2821
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2822
+ #
2823
+ # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
2824
+ #
2825
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2826
+ #
2827
+ # @example Basic example
2828
+ # require "google/cloud/translate/v3"
2829
+ #
2830
+ # # Create a client object. The client can be reused for multiple calls.
2831
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2832
+ #
2833
+ # # Create a request. To set request fields, pass in keyword arguments.
2834
+ # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
2835
+ #
2836
+ # # Call the get_adaptive_mt_file method.
2837
+ # result = client.get_adaptive_mt_file request
2838
+ #
2839
+ # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
2840
+ # p result
2841
+ #
2842
+ def get_adaptive_mt_file request, options = nil
2843
+ raise ::ArgumentError, "request must be provided" if request.nil?
2844
+
2845
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
2846
+
2847
+ # Converts hash and nil to an options object
2848
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2849
+
2850
+ # Customize the options with defaults
2851
+ call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
2852
+
2853
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2854
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2855
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2856
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2857
+ transports_version_send: [:rest]
2858
+
2859
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2860
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2861
+
2862
+ options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
2863
+ metadata: call_metadata,
2864
+ retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
2865
+
2866
+ options.apply_defaults timeout: @config.timeout,
2867
+ metadata: @config.metadata,
2868
+ retry_policy: @config.retry_policy
2869
+
2870
+ @translation_service_stub.get_adaptive_mt_file request, options do |result, operation|
2871
+ yield result, operation if block_given?
2872
+ return result
2873
+ end
2874
+ rescue ::Gapic::Rest::Error => e
2875
+ raise ::Google::Cloud::Error.from_error(e)
2876
+ end
2877
+
2878
+ ##
2879
+ # Deletes an AdaptiveMtFile along with its sentences.
2880
+ #
2881
+ # @overload delete_adaptive_mt_file(request, options = nil)
2882
+ # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
2883
+ # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
2884
+ #
2885
+ # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
2886
+ # A request object representing the call parameters. Required. To specify no
2887
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2888
+ # @param options [::Gapic::CallOptions, ::Hash]
2889
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2890
+ #
2891
+ # @overload delete_adaptive_mt_file(name: nil)
2892
+ # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
2893
+ # least one keyword argument is required. To specify no parameters, or to keep all
2894
+ # the default parameter values, pass an empty Hash as a request object (see above).
2895
+ #
2896
+ # @param name [::String]
2897
+ # Required. The resource name of the file to delete, in form of
2898
+ # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
2899
+ # @yield [result, operation] Access the result along with the TransportOperation object
2900
+ # @yieldparam result [::Google::Protobuf::Empty]
2901
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2902
+ #
2903
+ # @return [::Google::Protobuf::Empty]
2904
+ #
2905
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2906
+ #
2907
+ # @example Basic example
2908
+ # require "google/cloud/translate/v3"
2909
+ #
2910
+ # # Create a client object. The client can be reused for multiple calls.
2911
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2912
+ #
2913
+ # # Create a request. To set request fields, pass in keyword arguments.
2914
+ # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
2915
+ #
2916
+ # # Call the delete_adaptive_mt_file method.
2917
+ # result = client.delete_adaptive_mt_file request
2918
+ #
2919
+ # # The returned object is of type Google::Protobuf::Empty.
2920
+ # p result
2921
+ #
2922
+ def delete_adaptive_mt_file request, options = nil
2923
+ raise ::ArgumentError, "request must be provided" if request.nil?
2924
+
2925
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
2926
+
2927
+ # Converts hash and nil to an options object
2928
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2929
+
2930
+ # Customize the options with defaults
2931
+ call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
2932
+
2933
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2934
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2935
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2936
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
2937
+ transports_version_send: [:rest]
2938
+
2939
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2940
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2941
+
2942
+ options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
2943
+ metadata: call_metadata,
2944
+ retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
2945
+
2946
+ options.apply_defaults timeout: @config.timeout,
2947
+ metadata: @config.metadata,
2948
+ retry_policy: @config.retry_policy
2949
+
2950
+ @translation_service_stub.delete_adaptive_mt_file request, options do |result, operation|
2951
+ yield result, operation if block_given?
2952
+ return result
2953
+ end
2954
+ rescue ::Gapic::Rest::Error => e
2955
+ raise ::Google::Cloud::Error.from_error(e)
2956
+ end
2957
+
2958
+ ##
2959
+ # Imports an AdaptiveMtFile and adds all of its sentences into the
2960
+ # AdaptiveMtDataset.
2961
+ #
2962
+ # @overload import_adaptive_mt_file(request, options = nil)
2963
+ # Pass arguments to `import_adaptive_mt_file` via a request object, either of type
2964
+ # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
2965
+ #
2966
+ # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
2967
+ # A request object representing the call parameters. Required. To specify no
2968
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2969
+ # @param options [::Gapic::CallOptions, ::Hash]
2970
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2971
+ #
2972
+ # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
2973
+ # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
2974
+ # least one keyword argument is required. To specify no parameters, or to keep all
2975
+ # the default parameter values, pass an empty Hash as a request object (see above).
2976
+ #
2977
+ # @param parent [::String]
2978
+ # Required. The resource name of the file, in form of
2979
+ # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
2980
+ # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
2981
+ # Inline file source.
2982
+ # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
2983
+ # Google Cloud Storage file source.
2984
+ # @yield [result, operation] Access the result along with the TransportOperation object
2985
+ # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
2986
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2987
+ #
2988
+ # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
2989
+ #
2990
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2991
+ #
2992
+ # @example Basic example
2993
+ # require "google/cloud/translate/v3"
2994
+ #
2995
+ # # Create a client object. The client can be reused for multiple calls.
2996
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2997
+ #
2998
+ # # Create a request. To set request fields, pass in keyword arguments.
2999
+ # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
3000
+ #
3001
+ # # Call the import_adaptive_mt_file method.
3002
+ # result = client.import_adaptive_mt_file request
3003
+ #
3004
+ # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
3005
+ # p result
3006
+ #
3007
+ def import_adaptive_mt_file request, options = nil
3008
+ raise ::ArgumentError, "request must be provided" if request.nil?
3009
+
3010
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
3011
+
3012
+ # Converts hash and nil to an options object
3013
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3014
+
3015
+ # Customize the options with defaults
3016
+ call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
3017
+
3018
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3019
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3020
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3021
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
3022
+ transports_version_send: [:rest]
3023
+
3024
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3025
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3026
+
3027
+ options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
3028
+ metadata: call_metadata,
3029
+ retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
3030
+
3031
+ options.apply_defaults timeout: @config.timeout,
3032
+ metadata: @config.metadata,
3033
+ retry_policy: @config.retry_policy
3034
+
3035
+ @translation_service_stub.import_adaptive_mt_file request, options do |result, operation|
3036
+ yield result, operation if block_given?
3037
+ return result
3038
+ end
3039
+ rescue ::Gapic::Rest::Error => e
3040
+ raise ::Google::Cloud::Error.from_error(e)
3041
+ end
3042
+
3043
+ ##
3044
+ # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
3045
+ #
3046
+ # @overload list_adaptive_mt_files(request, options = nil)
3047
+ # Pass arguments to `list_adaptive_mt_files` via a request object, either of type
3048
+ # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
3049
+ #
3050
+ # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
3051
+ # A request object representing the call parameters. Required. To specify no
3052
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3053
+ # @param options [::Gapic::CallOptions, ::Hash]
3054
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
3055
+ #
3056
+ # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
3057
+ # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
3058
+ # least one keyword argument is required. To specify no parameters, or to keep all
3059
+ # the default parameter values, pass an empty Hash as a request object (see above).
3060
+ #
3061
+ # @param parent [::String]
3062
+ # Required. The resource name of the project from which to list the Adaptive
3063
+ # MT files.
3064
+ # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
3065
+ # @param page_size [::Integer]
3066
+ # Optional.
3067
+ # @param page_token [::String]
3068
+ # Optional. A token identifying a page of results the server should return.
3069
+ # Typically, this is the value of
3070
+ # ListAdaptiveMtFilesResponse.next_page_token returned from the
3071
+ # previous call to `ListAdaptiveMtFiles` method. The first page is
3072
+ # returned if `page_token`is empty or missing.
1665
3073
  # @yield [result, operation] Access the result along with the TransportOperation object
1666
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
3074
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
1667
3075
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1668
3076
  #
1669
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>]
3077
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
1670
3078
  #
1671
3079
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1672
3080
  #
@@ -1677,28 +3085,28 @@ module Google
1677
3085
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1678
3086
  #
1679
3087
  # # Create a request. To set request fields, pass in keyword arguments.
1680
- # request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new
3088
+ # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
1681
3089
  #
1682
- # # Call the list_adaptive_mt_datasets method.
1683
- # result = client.list_adaptive_mt_datasets request
3090
+ # # Call the list_adaptive_mt_files method.
3091
+ # result = client.list_adaptive_mt_files request
1684
3092
  #
1685
3093
  # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1686
3094
  # # over elements, and API calls will be issued to fetch pages as needed.
1687
3095
  # result.each do |item|
1688
- # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset.
3096
+ # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
1689
3097
  # p item
1690
3098
  # end
1691
3099
  #
1692
- def list_adaptive_mt_datasets request, options = nil
3100
+ def list_adaptive_mt_files request, options = nil
1693
3101
  raise ::ArgumentError, "request must be provided" if request.nil?
1694
3102
 
1695
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest
3103
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
1696
3104
 
1697
3105
  # Converts hash and nil to an options object
1698
3106
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1699
3107
 
1700
3108
  # Customize the options with defaults
1701
- call_metadata = @config.rpcs.list_adaptive_mt_datasets.metadata.to_h
3109
+ call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
1702
3110
 
1703
3111
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1704
3112
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1709,16 +3117,16 @@ module Google
1709
3117
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1710
3118
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1711
3119
 
1712
- options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_datasets.timeout,
3120
+ options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
1713
3121
  metadata: call_metadata,
1714
- retry_policy: @config.rpcs.list_adaptive_mt_datasets.retry_policy
3122
+ retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
1715
3123
 
1716
3124
  options.apply_defaults timeout: @config.timeout,
1717
3125
  metadata: @config.metadata,
1718
3126
  retry_policy: @config.retry_policy
1719
3127
 
1720
- @translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation|
1721
- result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options
3128
+ @translation_service_stub.list_adaptive_mt_files request, options do |result, operation|
3129
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options
1722
3130
  yield result, operation if block_given?
1723
3131
  return result
1724
3132
  end
@@ -1727,38 +3135,128 @@ module Google
1727
3135
  end
1728
3136
 
1729
3137
  ##
1730
- # Translate text using Adaptive MT.
3138
+ # Lists all AdaptiveMtSentences under a given file/dataset.
1731
3139
  #
1732
- # @overload adaptive_mt_translate(request, options = nil)
1733
- # Pass arguments to `adaptive_mt_translate` via a request object, either of type
1734
- # {::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest} or an equivalent Hash.
3140
+ # @overload list_adaptive_mt_sentences(request, options = nil)
3141
+ # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
3142
+ # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
1735
3143
  #
1736
- # @param request [::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash]
3144
+ # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
1737
3145
  # A request object representing the call parameters. Required. To specify no
1738
3146
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1739
3147
  # @param options [::Gapic::CallOptions, ::Hash]
1740
3148
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1741
3149
  #
1742
- # @overload adaptive_mt_translate(parent: nil, dataset: nil, content: nil)
1743
- # Pass arguments to `adaptive_mt_translate` via keyword arguments. Note that at
3150
+ # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
3151
+ # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
1744
3152
  # least one keyword argument is required. To specify no parameters, or to keep all
1745
3153
  # the default parameter values, pass an empty Hash as a request object (see above).
1746
3154
  #
1747
3155
  # @param parent [::String]
1748
- # Required. Location to make a regional call.
3156
+ # Required. The resource name of the project from which to list the Adaptive
3157
+ # MT files. The following format lists all sentences under a file.
3158
+ # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
3159
+ # The following format lists all sentences within a dataset.
3160
+ # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
3161
+ # @param page_size [::Integer]
3162
+ # @param page_token [::String]
3163
+ # A token identifying a page of results the server should return.
3164
+ # Typically, this is the value of
3165
+ # ListAdaptiveMtSentencesRequest.next_page_token returned from the
3166
+ # previous call to `ListTranslationMemories` method. The first page is
3167
+ # returned if `page_token` is empty or missing.
3168
+ # @yield [result, operation] Access the result along with the TransportOperation object
3169
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
3170
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
3171
+ #
3172
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
3173
+ #
3174
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
3175
+ #
3176
+ # @example Basic example
3177
+ # require "google/cloud/translate/v3"
3178
+ #
3179
+ # # Create a client object. The client can be reused for multiple calls.
3180
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
3181
+ #
3182
+ # # Create a request. To set request fields, pass in keyword arguments.
3183
+ # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
3184
+ #
3185
+ # # Call the list_adaptive_mt_sentences method.
3186
+ # result = client.list_adaptive_mt_sentences request
3187
+ #
3188
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3189
+ # # over elements, and API calls will be issued to fetch pages as needed.
3190
+ # result.each do |item|
3191
+ # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
3192
+ # p item
3193
+ # end
3194
+ #
3195
+ def list_adaptive_mt_sentences request, options = nil
3196
+ raise ::ArgumentError, "request must be provided" if request.nil?
3197
+
3198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
3199
+
3200
+ # Converts hash and nil to an options object
3201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3202
+
3203
+ # Customize the options with defaults
3204
+ call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
3205
+
3206
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3209
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
3210
+ transports_version_send: [:rest]
3211
+
3212
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3213
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3214
+
3215
+ options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
3216
+ metadata: call_metadata,
3217
+ retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
3218
+
3219
+ options.apply_defaults timeout: @config.timeout,
3220
+ metadata: @config.metadata,
3221
+ retry_policy: @config.retry_policy
3222
+
3223
+ @translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation|
3224
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options
3225
+ yield result, operation if block_given?
3226
+ return result
3227
+ end
3228
+ rescue ::Gapic::Rest::Error => e
3229
+ raise ::Google::Cloud::Error.from_error(e)
3230
+ end
3231
+
3232
+ ##
3233
+ # Import sentence pairs into translation Dataset.
3234
+ #
3235
+ # @overload import_data(request, options = nil)
3236
+ # Pass arguments to `import_data` via a request object, either of type
3237
+ # {::Google::Cloud::Translate::V3::ImportDataRequest} or an equivalent Hash.
3238
+ #
3239
+ # @param request [::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash]
3240
+ # A request object representing the call parameters. Required. To specify no
3241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3242
+ # @param options [::Gapic::CallOptions, ::Hash]
3243
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
3244
+ #
3245
+ # @overload import_data(dataset: nil, input_config: nil)
3246
+ # Pass arguments to `import_data` via keyword arguments. Note that at
3247
+ # least one keyword argument is required. To specify no parameters, or to keep all
3248
+ # the default parameter values, pass an empty Hash as a request object (see above).
1749
3249
  #
1750
- # Format: `projects/{project-number-or-id}/locations/{location-id}`.
1751
3250
  # @param dataset [::String]
1752
- # Required. The resource name for the dataset to use for adaptive MT.
1753
- # `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
1754
- # @param content [::Array<::String>]
1755
- # Required. The content of the input in string format.
1756
- # For now only one sentence per request is supported.
3251
+ # Required. Name of the dataset. In form of
3252
+ # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
3253
+ # @param input_config [::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash]
3254
+ # Required. The config for the input content.
1757
3255
  # @yield [result, operation] Access the result along with the TransportOperation object
1758
- # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
3256
+ # @yieldparam result [::Gapic::Operation]
1759
3257
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1760
3258
  #
1761
- # @return [::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse]
3259
+ # @return [::Gapic::Operation]
1762
3260
  #
1763
3261
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1764
3262
  #
@@ -1769,24 +3267,121 @@ module Google
1769
3267
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1770
3268
  #
1771
3269
  # # Create a request. To set request fields, pass in keyword arguments.
1772
- # request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new
3270
+ # request = Google::Cloud::Translate::V3::ImportDataRequest.new
1773
3271
  #
1774
- # # Call the adaptive_mt_translate method.
1775
- # result = client.adaptive_mt_translate request
3272
+ # # Call the import_data method.
3273
+ # result = client.import_data request
1776
3274
  #
1777
- # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse.
1778
- # p result
3275
+ # # The returned object is of type Gapic::Operation. You can use it to
3276
+ # # check the status of an operation, cancel it, or wait for results.
3277
+ # # Here is how to wait for a response.
3278
+ # result.wait_until_done! timeout: 60
3279
+ # if result.response?
3280
+ # p result.response
3281
+ # else
3282
+ # puts "No response received."
3283
+ # end
3284
+ #
3285
+ def import_data request, options = nil
3286
+ raise ::ArgumentError, "request must be provided" if request.nil?
3287
+
3288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportDataRequest
3289
+
3290
+ # Converts hash and nil to an options object
3291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3292
+
3293
+ # Customize the options with defaults
3294
+ call_metadata = @config.rpcs.import_data.metadata.to_h
3295
+
3296
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3297
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3299
+ gapic_version: ::Google::Cloud::Translate::V3::VERSION,
3300
+ transports_version_send: [:rest]
3301
+
3302
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3303
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3304
+
3305
+ options.apply_defaults timeout: @config.rpcs.import_data.timeout,
3306
+ metadata: call_metadata,
3307
+ retry_policy: @config.rpcs.import_data.retry_policy
3308
+
3309
+ options.apply_defaults timeout: @config.timeout,
3310
+ metadata: @config.metadata,
3311
+ retry_policy: @config.retry_policy
3312
+
3313
+ @translation_service_stub.import_data request, options do |result, operation|
3314
+ result = ::Gapic::Operation.new result, @operations_client, options: options
3315
+ yield result, operation if block_given?
3316
+ return result
3317
+ end
3318
+ rescue ::Gapic::Rest::Error => e
3319
+ raise ::Google::Cloud::Error.from_error(e)
3320
+ end
3321
+
3322
+ ##
3323
+ # Exports dataset's data to the provided output location.
3324
+ #
3325
+ # @overload export_data(request, options = nil)
3326
+ # Pass arguments to `export_data` via a request object, either of type
3327
+ # {::Google::Cloud::Translate::V3::ExportDataRequest} or an equivalent Hash.
3328
+ #
3329
+ # @param request [::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash]
3330
+ # A request object representing the call parameters. Required. To specify no
3331
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3332
+ # @param options [::Gapic::CallOptions, ::Hash]
3333
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
3334
+ #
3335
+ # @overload export_data(dataset: nil, output_config: nil)
3336
+ # Pass arguments to `export_data` via keyword arguments. Note that at
3337
+ # least one keyword argument is required. To specify no parameters, or to keep all
3338
+ # the default parameter values, pass an empty Hash as a request object (see above).
3339
+ #
3340
+ # @param dataset [::String]
3341
+ # Required. Name of the dataset. In form of
3342
+ # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
3343
+ # @param output_config [::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash]
3344
+ # Required. The config for the output content.
3345
+ # @yield [result, operation] Access the result along with the TransportOperation object
3346
+ # @yieldparam result [::Gapic::Operation]
3347
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
3348
+ #
3349
+ # @return [::Gapic::Operation]
3350
+ #
3351
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
3352
+ #
3353
+ # @example Basic example
3354
+ # require "google/cloud/translate/v3"
3355
+ #
3356
+ # # Create a client object. The client can be reused for multiple calls.
3357
+ # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
3358
+ #
3359
+ # # Create a request. To set request fields, pass in keyword arguments.
3360
+ # request = Google::Cloud::Translate::V3::ExportDataRequest.new
3361
+ #
3362
+ # # Call the export_data method.
3363
+ # result = client.export_data request
3364
+ #
3365
+ # # The returned object is of type Gapic::Operation. You can use it to
3366
+ # # check the status of an operation, cancel it, or wait for results.
3367
+ # # Here is how to wait for a response.
3368
+ # result.wait_until_done! timeout: 60
3369
+ # if result.response?
3370
+ # p result.response
3371
+ # else
3372
+ # puts "No response received."
3373
+ # end
1779
3374
  #
1780
- def adaptive_mt_translate request, options = nil
3375
+ def export_data request, options = nil
1781
3376
  raise ::ArgumentError, "request must be provided" if request.nil?
1782
3377
 
1783
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest
3378
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ExportDataRequest
1784
3379
 
1785
3380
  # Converts hash and nil to an options object
1786
3381
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1787
3382
 
1788
3383
  # Customize the options with defaults
1789
- call_metadata = @config.rpcs.adaptive_mt_translate.metadata.to_h
3384
+ call_metadata = @config.rpcs.export_data.metadata.to_h
1790
3385
 
1791
3386
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1792
3387
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1797,15 +3392,16 @@ module Google
1797
3392
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1798
3393
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1799
3394
 
1800
- options.apply_defaults timeout: @config.rpcs.adaptive_mt_translate.timeout,
3395
+ options.apply_defaults timeout: @config.rpcs.export_data.timeout,
1801
3396
  metadata: call_metadata,
1802
- retry_policy: @config.rpcs.adaptive_mt_translate.retry_policy
3397
+ retry_policy: @config.rpcs.export_data.retry_policy
1803
3398
 
1804
3399
  options.apply_defaults timeout: @config.timeout,
1805
3400
  metadata: @config.metadata,
1806
3401
  retry_policy: @config.retry_policy
1807
3402
 
1808
- @translation_service_stub.adaptive_mt_translate request, options do |result, operation|
3403
+ @translation_service_stub.export_data request, options do |result, operation|
3404
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1809
3405
  yield result, operation if block_given?
1810
3406
  return result
1811
3407
  end
@@ -1814,31 +3410,42 @@ module Google
1814
3410
  end
1815
3411
 
1816
3412
  ##
1817
- # Gets and AdaptiveMtFile
3413
+ # Lists sentence pairs in the dataset.
1818
3414
  #
1819
- # @overload get_adaptive_mt_file(request, options = nil)
1820
- # Pass arguments to `get_adaptive_mt_file` via a request object, either of type
1821
- # {::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest} or an equivalent Hash.
3415
+ # @overload list_examples(request, options = nil)
3416
+ # Pass arguments to `list_examples` via a request object, either of type
3417
+ # {::Google::Cloud::Translate::V3::ListExamplesRequest} or an equivalent Hash.
1822
3418
  #
1823
- # @param request [::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash]
3419
+ # @param request [::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash]
1824
3420
  # A request object representing the call parameters. Required. To specify no
1825
3421
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1826
3422
  # @param options [::Gapic::CallOptions, ::Hash]
1827
3423
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1828
3424
  #
1829
- # @overload get_adaptive_mt_file(name: nil)
1830
- # Pass arguments to `get_adaptive_mt_file` via keyword arguments. Note that at
3425
+ # @overload list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil)
3426
+ # Pass arguments to `list_examples` via keyword arguments. Note that at
1831
3427
  # least one keyword argument is required. To specify no parameters, or to keep all
1832
3428
  # the default parameter values, pass an empty Hash as a request object (see above).
1833
3429
  #
1834
- # @param name [::String]
1835
- # Required. The resource name of the file, in form of
1836
- # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
3430
+ # @param parent [::String]
3431
+ # Required. Name of the parent dataset. In form of
3432
+ # `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
3433
+ # @param filter [::String]
3434
+ # Optional. An expression for filtering the examples that will be returned.
3435
+ # Example filter:
3436
+ # * `usage=TRAIN`
3437
+ # @param page_size [::Integer]
3438
+ # Optional. Requested page size. The server can return fewer results than
3439
+ # requested.
3440
+ # @param page_token [::String]
3441
+ # Optional. A token identifying a page of results for the server to return.
3442
+ # Typically obtained from next_page_token field in the response of a
3443
+ # ListExamples call.
1837
3444
  # @yield [result, operation] Access the result along with the TransportOperation object
1838
- # @yieldparam result [::Google::Cloud::Translate::V3::AdaptiveMtFile]
3445
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>]
1839
3446
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1840
3447
  #
1841
- # @return [::Google::Cloud::Translate::V3::AdaptiveMtFile]
3448
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>]
1842
3449
  #
1843
3450
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1844
3451
  #
@@ -1849,24 +3456,28 @@ module Google
1849
3456
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1850
3457
  #
1851
3458
  # # Create a request. To set request fields, pass in keyword arguments.
1852
- # request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new
3459
+ # request = Google::Cloud::Translate::V3::ListExamplesRequest.new
1853
3460
  #
1854
- # # Call the get_adaptive_mt_file method.
1855
- # result = client.get_adaptive_mt_file request
3461
+ # # Call the list_examples method.
3462
+ # result = client.list_examples request
1856
3463
  #
1857
- # # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile.
1858
- # p result
3464
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3465
+ # # over elements, and API calls will be issued to fetch pages as needed.
3466
+ # result.each do |item|
3467
+ # # Each element is of type ::Google::Cloud::Translate::V3::Example.
3468
+ # p item
3469
+ # end
1859
3470
  #
1860
- def get_adaptive_mt_file request, options = nil
3471
+ def list_examples request, options = nil
1861
3472
  raise ::ArgumentError, "request must be provided" if request.nil?
1862
3473
 
1863
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest
3474
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListExamplesRequest
1864
3475
 
1865
3476
  # Converts hash and nil to an options object
1866
3477
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1867
3478
 
1868
3479
  # Customize the options with defaults
1869
- call_metadata = @config.rpcs.get_adaptive_mt_file.metadata.to_h
3480
+ call_metadata = @config.rpcs.list_examples.metadata.to_h
1870
3481
 
1871
3482
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1872
3483
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1877,15 +3488,16 @@ module Google
1877
3488
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1878
3489
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1879
3490
 
1880
- options.apply_defaults timeout: @config.rpcs.get_adaptive_mt_file.timeout,
3491
+ options.apply_defaults timeout: @config.rpcs.list_examples.timeout,
1881
3492
  metadata: call_metadata,
1882
- retry_policy: @config.rpcs.get_adaptive_mt_file.retry_policy
3493
+ retry_policy: @config.rpcs.list_examples.retry_policy
1883
3494
 
1884
3495
  options.apply_defaults timeout: @config.timeout,
1885
3496
  metadata: @config.metadata,
1886
3497
  retry_policy: @config.retry_policy
1887
3498
 
1888
- @translation_service_stub.get_adaptive_mt_file request, options do |result, operation|
3499
+ @translation_service_stub.list_examples request, options do |result, operation|
3500
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_examples, "examples", request, result, options
1889
3501
  yield result, operation if block_given?
1890
3502
  return result
1891
3503
  end
@@ -1894,31 +3506,33 @@ module Google
1894
3506
  end
1895
3507
 
1896
3508
  ##
1897
- # Deletes an AdaptiveMtFile along with its sentences.
3509
+ # Creates a Model.
1898
3510
  #
1899
- # @overload delete_adaptive_mt_file(request, options = nil)
1900
- # Pass arguments to `delete_adaptive_mt_file` via a request object, either of type
1901
- # {::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest} or an equivalent Hash.
3511
+ # @overload create_model(request, options = nil)
3512
+ # Pass arguments to `create_model` via a request object, either of type
3513
+ # {::Google::Cloud::Translate::V3::CreateModelRequest} or an equivalent Hash.
1902
3514
  #
1903
- # @param request [::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash]
3515
+ # @param request [::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash]
1904
3516
  # A request object representing the call parameters. Required. To specify no
1905
3517
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1906
3518
  # @param options [::Gapic::CallOptions, ::Hash]
1907
3519
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1908
3520
  #
1909
- # @overload delete_adaptive_mt_file(name: nil)
1910
- # Pass arguments to `delete_adaptive_mt_file` via keyword arguments. Note that at
3521
+ # @overload create_model(parent: nil, model: nil)
3522
+ # Pass arguments to `create_model` via keyword arguments. Note that at
1911
3523
  # least one keyword argument is required. To specify no parameters, or to keep all
1912
3524
  # the default parameter values, pass an empty Hash as a request object (see above).
1913
3525
  #
1914
- # @param name [::String]
1915
- # Required. The resource name of the file to delete, in form of
1916
- # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
3526
+ # @param parent [::String]
3527
+ # Required. The project name, in form of
3528
+ # `projects/{project}/locations/{location}`
3529
+ # @param model [::Google::Cloud::Translate::V3::Model, ::Hash]
3530
+ # Required. The Model to create.
1917
3531
  # @yield [result, operation] Access the result along with the TransportOperation object
1918
- # @yieldparam result [::Google::Protobuf::Empty]
3532
+ # @yieldparam result [::Gapic::Operation]
1919
3533
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
1920
3534
  #
1921
- # @return [::Google::Protobuf::Empty]
3535
+ # @return [::Gapic::Operation]
1922
3536
  #
1923
3537
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
1924
3538
  #
@@ -1929,24 +3543,31 @@ module Google
1929
3543
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
1930
3544
  #
1931
3545
  # # Create a request. To set request fields, pass in keyword arguments.
1932
- # request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new
3546
+ # request = Google::Cloud::Translate::V3::CreateModelRequest.new
1933
3547
  #
1934
- # # Call the delete_adaptive_mt_file method.
1935
- # result = client.delete_adaptive_mt_file request
3548
+ # # Call the create_model method.
3549
+ # result = client.create_model request
1936
3550
  #
1937
- # # The returned object is of type Google::Protobuf::Empty.
1938
- # p result
3551
+ # # The returned object is of type Gapic::Operation. You can use it to
3552
+ # # check the status of an operation, cancel it, or wait for results.
3553
+ # # Here is how to wait for a response.
3554
+ # result.wait_until_done! timeout: 60
3555
+ # if result.response?
3556
+ # p result.response
3557
+ # else
3558
+ # puts "No response received."
3559
+ # end
1939
3560
  #
1940
- def delete_adaptive_mt_file request, options = nil
3561
+ def create_model request, options = nil
1941
3562
  raise ::ArgumentError, "request must be provided" if request.nil?
1942
3563
 
1943
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest
3564
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::CreateModelRequest
1944
3565
 
1945
3566
  # Converts hash and nil to an options object
1946
3567
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1947
3568
 
1948
3569
  # Customize the options with defaults
1949
- call_metadata = @config.rpcs.delete_adaptive_mt_file.metadata.to_h
3570
+ call_metadata = @config.rpcs.create_model.metadata.to_h
1950
3571
 
1951
3572
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1952
3573
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -1957,15 +3578,16 @@ module Google
1957
3578
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1958
3579
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1959
3580
 
1960
- options.apply_defaults timeout: @config.rpcs.delete_adaptive_mt_file.timeout,
3581
+ options.apply_defaults timeout: @config.rpcs.create_model.timeout,
1961
3582
  metadata: call_metadata,
1962
- retry_policy: @config.rpcs.delete_adaptive_mt_file.retry_policy
3583
+ retry_policy: @config.rpcs.create_model.retry_policy
1963
3584
 
1964
3585
  options.apply_defaults timeout: @config.timeout,
1965
3586
  metadata: @config.metadata,
1966
3587
  retry_policy: @config.retry_policy
1967
3588
 
1968
- @translation_service_stub.delete_adaptive_mt_file request, options do |result, operation|
3589
+ @translation_service_stub.create_model request, options do |result, operation|
3590
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1969
3591
  yield result, operation if block_given?
1970
3592
  return result
1971
3593
  end
@@ -1974,36 +3596,42 @@ module Google
1974
3596
  end
1975
3597
 
1976
3598
  ##
1977
- # Imports an AdaptiveMtFile and adds all of its sentences into the
1978
- # AdaptiveMtDataset.
3599
+ # Lists models.
1979
3600
  #
1980
- # @overload import_adaptive_mt_file(request, options = nil)
1981
- # Pass arguments to `import_adaptive_mt_file` via a request object, either of type
1982
- # {::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest} or an equivalent Hash.
3601
+ # @overload list_models(request, options = nil)
3602
+ # Pass arguments to `list_models` via a request object, either of type
3603
+ # {::Google::Cloud::Translate::V3::ListModelsRequest} or an equivalent Hash.
1983
3604
  #
1984
- # @param request [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash]
3605
+ # @param request [::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash]
1985
3606
  # A request object representing the call parameters. Required. To specify no
1986
3607
  # parameters, or to keep all the default parameter values, pass an empty Hash.
1987
3608
  # @param options [::Gapic::CallOptions, ::Hash]
1988
3609
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1989
3610
  #
1990
- # @overload import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil)
1991
- # Pass arguments to `import_adaptive_mt_file` via keyword arguments. Note that at
3611
+ # @overload list_models(parent: nil, filter: nil, page_size: nil, page_token: nil)
3612
+ # Pass arguments to `list_models` via keyword arguments. Note that at
1992
3613
  # least one keyword argument is required. To specify no parameters, or to keep all
1993
3614
  # the default parameter values, pass an empty Hash as a request object (see above).
1994
3615
  #
1995
3616
  # @param parent [::String]
1996
- # Required. The resource name of the file, in form of
1997
- # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
1998
- # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
1999
- # Inline file source.
2000
- # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
2001
- # Google Cloud Storage file source.
3617
+ # Required. Name of the parent project. In form of
3618
+ # `projects/{project-number-or-id}/locations/{location-id}`
3619
+ # @param filter [::String]
3620
+ # Optional. An expression for filtering the models that will be returned.
3621
+ # Supported filter:
3622
+ # `dataset_id=${dataset_id}`
3623
+ # @param page_size [::Integer]
3624
+ # Optional. Requested page size. The server can return fewer results than
3625
+ # requested.
3626
+ # @param page_token [::String]
3627
+ # Optional. A token identifying a page of results for the server to return.
3628
+ # Typically obtained from next_page_token field in the response of a
3629
+ # ListModels call.
2002
3630
  # @yield [result, operation] Access the result along with the TransportOperation object
2003
- # @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
3631
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>]
2004
3632
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
2005
3633
  #
2006
- # @return [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
3634
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>]
2007
3635
  #
2008
3636
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
2009
3637
  #
@@ -2014,24 +3642,28 @@ module Google
2014
3642
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2015
3643
  #
2016
3644
  # # Create a request. To set request fields, pass in keyword arguments.
2017
- # request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new
3645
+ # request = Google::Cloud::Translate::V3::ListModelsRequest.new
2018
3646
  #
2019
- # # Call the import_adaptive_mt_file method.
2020
- # result = client.import_adaptive_mt_file request
3647
+ # # Call the list_models method.
3648
+ # result = client.list_models request
2021
3649
  #
2022
- # # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse.
2023
- # p result
3650
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
3651
+ # # over elements, and API calls will be issued to fetch pages as needed.
3652
+ # result.each do |item|
3653
+ # # Each element is of type ::Google::Cloud::Translate::V3::Model.
3654
+ # p item
3655
+ # end
2024
3656
  #
2025
- def import_adaptive_mt_file request, options = nil
3657
+ def list_models request, options = nil
2026
3658
  raise ::ArgumentError, "request must be provided" if request.nil?
2027
3659
 
2028
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest
3660
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListModelsRequest
2029
3661
 
2030
3662
  # Converts hash and nil to an options object
2031
3663
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2032
3664
 
2033
3665
  # Customize the options with defaults
2034
- call_metadata = @config.rpcs.import_adaptive_mt_file.metadata.to_h
3666
+ call_metadata = @config.rpcs.list_models.metadata.to_h
2035
3667
 
2036
3668
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2037
3669
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -2042,15 +3674,16 @@ module Google
2042
3674
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2043
3675
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2044
3676
 
2045
- options.apply_defaults timeout: @config.rpcs.import_adaptive_mt_file.timeout,
3677
+ options.apply_defaults timeout: @config.rpcs.list_models.timeout,
2046
3678
  metadata: call_metadata,
2047
- retry_policy: @config.rpcs.import_adaptive_mt_file.retry_policy
3679
+ retry_policy: @config.rpcs.list_models.retry_policy
2048
3680
 
2049
3681
  options.apply_defaults timeout: @config.timeout,
2050
3682
  metadata: @config.metadata,
2051
3683
  retry_policy: @config.retry_policy
2052
3684
 
2053
- @translation_service_stub.import_adaptive_mt_file request, options do |result, operation|
3685
+ @translation_service_stub.list_models request, options do |result, operation|
3686
+ result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_models, "models", request, result, options
2054
3687
  yield result, operation if block_given?
2055
3688
  return result
2056
3689
  end
@@ -2059,40 +3692,30 @@ module Google
2059
3692
  end
2060
3693
 
2061
3694
  ##
2062
- # Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
3695
+ # Gets a model.
2063
3696
  #
2064
- # @overload list_adaptive_mt_files(request, options = nil)
2065
- # Pass arguments to `list_adaptive_mt_files` via a request object, either of type
2066
- # {::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest} or an equivalent Hash.
3697
+ # @overload get_model(request, options = nil)
3698
+ # Pass arguments to `get_model` via a request object, either of type
3699
+ # {::Google::Cloud::Translate::V3::GetModelRequest} or an equivalent Hash.
2067
3700
  #
2068
- # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash]
3701
+ # @param request [::Google::Cloud::Translate::V3::GetModelRequest, ::Hash]
2069
3702
  # A request object representing the call parameters. Required. To specify no
2070
3703
  # parameters, or to keep all the default parameter values, pass an empty Hash.
2071
3704
  # @param options [::Gapic::CallOptions, ::Hash]
2072
3705
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2073
3706
  #
2074
- # @overload list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil)
2075
- # Pass arguments to `list_adaptive_mt_files` via keyword arguments. Note that at
3707
+ # @overload get_model(name: nil)
3708
+ # Pass arguments to `get_model` via keyword arguments. Note that at
2076
3709
  # least one keyword argument is required. To specify no parameters, or to keep all
2077
3710
  # the default parameter values, pass an empty Hash as a request object (see above).
2078
3711
  #
2079
- # @param parent [::String]
2080
- # Required. The resource name of the project from which to list the Adaptive
2081
- # MT files.
2082
- # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
2083
- # @param page_size [::Integer]
2084
- # Optional.
2085
- # @param page_token [::String]
2086
- # Optional. A token identifying a page of results the server should return.
2087
- # Typically, this is the value of
2088
- # ListAdaptiveMtFilesResponse.next_page_token returned from the
2089
- # previous call to `ListAdaptiveMtFiles` method. The first page is
2090
- # returned if `page_token`is empty or missing.
3712
+ # @param name [::String]
3713
+ # Required. The resource name of the model to retrieve.
2091
3714
  # @yield [result, operation] Access the result along with the TransportOperation object
2092
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
3715
+ # @yieldparam result [::Google::Cloud::Translate::V3::Model]
2093
3716
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
2094
3717
  #
2095
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>]
3718
+ # @return [::Google::Cloud::Translate::V3::Model]
2096
3719
  #
2097
3720
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
2098
3721
  #
@@ -2103,28 +3726,24 @@ module Google
2103
3726
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2104
3727
  #
2105
3728
  # # Create a request. To set request fields, pass in keyword arguments.
2106
- # request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new
3729
+ # request = Google::Cloud::Translate::V3::GetModelRequest.new
2107
3730
  #
2108
- # # Call the list_adaptive_mt_files method.
2109
- # result = client.list_adaptive_mt_files request
3731
+ # # Call the get_model method.
3732
+ # result = client.get_model request
2110
3733
  #
2111
- # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2112
- # # over elements, and API calls will be issued to fetch pages as needed.
2113
- # result.each do |item|
2114
- # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile.
2115
- # p item
2116
- # end
3734
+ # # The returned object is of type Google::Cloud::Translate::V3::Model.
3735
+ # p result
2117
3736
  #
2118
- def list_adaptive_mt_files request, options = nil
3737
+ def get_model request, options = nil
2119
3738
  raise ::ArgumentError, "request must be provided" if request.nil?
2120
3739
 
2121
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest
3740
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::GetModelRequest
2122
3741
 
2123
3742
  # Converts hash and nil to an options object
2124
3743
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2125
3744
 
2126
3745
  # Customize the options with defaults
2127
- call_metadata = @config.rpcs.list_adaptive_mt_files.metadata.to_h
3746
+ call_metadata = @config.rpcs.get_model.metadata.to_h
2128
3747
 
2129
3748
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2130
3749
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -2135,16 +3754,15 @@ module Google
2135
3754
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2136
3755
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2137
3756
 
2138
- options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_files.timeout,
3757
+ options.apply_defaults timeout: @config.rpcs.get_model.timeout,
2139
3758
  metadata: call_metadata,
2140
- retry_policy: @config.rpcs.list_adaptive_mt_files.retry_policy
3759
+ retry_policy: @config.rpcs.get_model.retry_policy
2141
3760
 
2142
3761
  options.apply_defaults timeout: @config.timeout,
2143
3762
  metadata: @config.metadata,
2144
3763
  retry_policy: @config.retry_policy
2145
3764
 
2146
- @translation_service_stub.list_adaptive_mt_files request, options do |result, operation|
2147
- result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options
3765
+ @translation_service_stub.get_model request, options do |result, operation|
2148
3766
  yield result, operation if block_given?
2149
3767
  return result
2150
3768
  end
@@ -2153,41 +3771,30 @@ module Google
2153
3771
  end
2154
3772
 
2155
3773
  ##
2156
- # Lists all AdaptiveMtSentences under a given file/dataset.
3774
+ # Deletes a model.
2157
3775
  #
2158
- # @overload list_adaptive_mt_sentences(request, options = nil)
2159
- # Pass arguments to `list_adaptive_mt_sentences` via a request object, either of type
2160
- # {::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest} or an equivalent Hash.
3776
+ # @overload delete_model(request, options = nil)
3777
+ # Pass arguments to `delete_model` via a request object, either of type
3778
+ # {::Google::Cloud::Translate::V3::DeleteModelRequest} or an equivalent Hash.
2161
3779
  #
2162
- # @param request [::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash]
3780
+ # @param request [::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash]
2163
3781
  # A request object representing the call parameters. Required. To specify no
2164
3782
  # parameters, or to keep all the default parameter values, pass an empty Hash.
2165
3783
  # @param options [::Gapic::CallOptions, ::Hash]
2166
3784
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2167
3785
  #
2168
- # @overload list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil)
2169
- # Pass arguments to `list_adaptive_mt_sentences` via keyword arguments. Note that at
3786
+ # @overload delete_model(name: nil)
3787
+ # Pass arguments to `delete_model` via keyword arguments. Note that at
2170
3788
  # least one keyword argument is required. To specify no parameters, or to keep all
2171
3789
  # the default parameter values, pass an empty Hash as a request object (see above).
2172
3790
  #
2173
- # @param parent [::String]
2174
- # Required. The resource name of the project from which to list the Adaptive
2175
- # MT files. The following format lists all sentences under a file.
2176
- # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
2177
- # The following format lists all sentences within a dataset.
2178
- # `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
2179
- # @param page_size [::Integer]
2180
- # @param page_token [::String]
2181
- # A token identifying a page of results the server should return.
2182
- # Typically, this is the value of
2183
- # ListAdaptiveMtSentencesRequest.next_page_token returned from the
2184
- # previous call to `ListTranslationMemories` method. The first page is
2185
- # returned if `page_token` is empty or missing.
3791
+ # @param name [::String]
3792
+ # Required. The name of the model to delete.
2186
3793
  # @yield [result, operation] Access the result along with the TransportOperation object
2187
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
3794
+ # @yieldparam result [::Gapic::Operation]
2188
3795
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
2189
3796
  #
2190
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>]
3797
+ # @return [::Gapic::Operation]
2191
3798
  #
2192
3799
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
2193
3800
  #
@@ -2198,28 +3805,31 @@ module Google
2198
3805
  # client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
2199
3806
  #
2200
3807
  # # Create a request. To set request fields, pass in keyword arguments.
2201
- # request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new
3808
+ # request = Google::Cloud::Translate::V3::DeleteModelRequest.new
2202
3809
  #
2203
- # # Call the list_adaptive_mt_sentences method.
2204
- # result = client.list_adaptive_mt_sentences request
3810
+ # # Call the delete_model method.
3811
+ # result = client.delete_model request
2205
3812
  #
2206
- # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2207
- # # over elements, and API calls will be issued to fetch pages as needed.
2208
- # result.each do |item|
2209
- # # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence.
2210
- # p item
3813
+ # # The returned object is of type Gapic::Operation. You can use it to
3814
+ # # check the status of an operation, cancel it, or wait for results.
3815
+ # # Here is how to wait for a response.
3816
+ # result.wait_until_done! timeout: 60
3817
+ # if result.response?
3818
+ # p result.response
3819
+ # else
3820
+ # puts "No response received."
2211
3821
  # end
2212
3822
  #
2213
- def list_adaptive_mt_sentences request, options = nil
3823
+ def delete_model request, options = nil
2214
3824
  raise ::ArgumentError, "request must be provided" if request.nil?
2215
3825
 
2216
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest
3826
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::DeleteModelRequest
2217
3827
 
2218
3828
  # Converts hash and nil to an options object
2219
3829
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2220
3830
 
2221
3831
  # Customize the options with defaults
2222
- call_metadata = @config.rpcs.list_adaptive_mt_sentences.metadata.to_h
3832
+ call_metadata = @config.rpcs.delete_model.metadata.to_h
2223
3833
 
2224
3834
  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2225
3835
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -2230,16 +3840,16 @@ module Google
2230
3840
  call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2231
3841
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2232
3842
 
2233
- options.apply_defaults timeout: @config.rpcs.list_adaptive_mt_sentences.timeout,
3843
+ options.apply_defaults timeout: @config.rpcs.delete_model.timeout,
2234
3844
  metadata: call_metadata,
2235
- retry_policy: @config.rpcs.list_adaptive_mt_sentences.retry_policy
3845
+ retry_policy: @config.rpcs.delete_model.retry_policy
2236
3846
 
2237
3847
  options.apply_defaults timeout: @config.timeout,
2238
3848
  metadata: @config.metadata,
2239
3849
  retry_policy: @config.retry_policy
2240
3850
 
2241
- @translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation|
2242
- result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options
3851
+ @translation_service_stub.delete_model request, options do |result, operation|
3852
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2243
3853
  yield result, operation if block_given?
2244
3854
  return result
2245
3855
  end
@@ -2343,6 +3953,13 @@ module Google
2343
3953
  config_attr :quota_project, nil, ::String, nil
2344
3954
  config_attr :universe_domain, nil, ::String, nil
2345
3955
 
3956
+ # @private
3957
+ # Overrides for http bindings for the RPCs of this service
3958
+ # are only used when this service is used as mixin, and only
3959
+ # by the host service.
3960
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3961
+ config_attr :bindings_override, {}, ::Hash, nil
3962
+
2346
3963
  # @private
2347
3964
  def initialize parent_config = nil
2348
3965
  @parent_config = parent_config unless parent_config.nil?
@@ -2386,6 +4003,11 @@ module Google
2386
4003
  #
2387
4004
  attr_reader :translate_text
2388
4005
  ##
4006
+ # RPC-specific configuration for `romanize_text`
4007
+ # @return [::Gapic::Config::Method]
4008
+ #
4009
+ attr_reader :romanize_text
4010
+ ##
2389
4011
  # RPC-specific configuration for `detect_language`
2390
4012
  # @return [::Gapic::Config::Method]
2391
4013
  #
@@ -2416,6 +4038,11 @@ module Google
2416
4038
  #
2417
4039
  attr_reader :create_glossary
2418
4040
  ##
4041
+ # RPC-specific configuration for `update_glossary`
4042
+ # @return [::Gapic::Config::Method]
4043
+ #
4044
+ attr_reader :update_glossary
4045
+ ##
2419
4046
  # RPC-specific configuration for `list_glossaries`
2420
4047
  # @return [::Gapic::Config::Method]
2421
4048
  #
@@ -2431,6 +4058,51 @@ module Google
2431
4058
  #
2432
4059
  attr_reader :delete_glossary
2433
4060
  ##
4061
+ # RPC-specific configuration for `get_glossary_entry`
4062
+ # @return [::Gapic::Config::Method]
4063
+ #
4064
+ attr_reader :get_glossary_entry
4065
+ ##
4066
+ # RPC-specific configuration for `list_glossary_entries`
4067
+ # @return [::Gapic::Config::Method]
4068
+ #
4069
+ attr_reader :list_glossary_entries
4070
+ ##
4071
+ # RPC-specific configuration for `create_glossary_entry`
4072
+ # @return [::Gapic::Config::Method]
4073
+ #
4074
+ attr_reader :create_glossary_entry
4075
+ ##
4076
+ # RPC-specific configuration for `update_glossary_entry`
4077
+ # @return [::Gapic::Config::Method]
4078
+ #
4079
+ attr_reader :update_glossary_entry
4080
+ ##
4081
+ # RPC-specific configuration for `delete_glossary_entry`
4082
+ # @return [::Gapic::Config::Method]
4083
+ #
4084
+ attr_reader :delete_glossary_entry
4085
+ ##
4086
+ # RPC-specific configuration for `create_dataset`
4087
+ # @return [::Gapic::Config::Method]
4088
+ #
4089
+ attr_reader :create_dataset
4090
+ ##
4091
+ # RPC-specific configuration for `get_dataset`
4092
+ # @return [::Gapic::Config::Method]
4093
+ #
4094
+ attr_reader :get_dataset
4095
+ ##
4096
+ # RPC-specific configuration for `list_datasets`
4097
+ # @return [::Gapic::Config::Method]
4098
+ #
4099
+ attr_reader :list_datasets
4100
+ ##
4101
+ # RPC-specific configuration for `delete_dataset`
4102
+ # @return [::Gapic::Config::Method]
4103
+ #
4104
+ attr_reader :delete_dataset
4105
+ ##
2434
4106
  # RPC-specific configuration for `create_adaptive_mt_dataset`
2435
4107
  # @return [::Gapic::Config::Method]
2436
4108
  #
@@ -2480,11 +4152,48 @@ module Google
2480
4152
  # @return [::Gapic::Config::Method]
2481
4153
  #
2482
4154
  attr_reader :list_adaptive_mt_sentences
4155
+ ##
4156
+ # RPC-specific configuration for `import_data`
4157
+ # @return [::Gapic::Config::Method]
4158
+ #
4159
+ attr_reader :import_data
4160
+ ##
4161
+ # RPC-specific configuration for `export_data`
4162
+ # @return [::Gapic::Config::Method]
4163
+ #
4164
+ attr_reader :export_data
4165
+ ##
4166
+ # RPC-specific configuration for `list_examples`
4167
+ # @return [::Gapic::Config::Method]
4168
+ #
4169
+ attr_reader :list_examples
4170
+ ##
4171
+ # RPC-specific configuration for `create_model`
4172
+ # @return [::Gapic::Config::Method]
4173
+ #
4174
+ attr_reader :create_model
4175
+ ##
4176
+ # RPC-specific configuration for `list_models`
4177
+ # @return [::Gapic::Config::Method]
4178
+ #
4179
+ attr_reader :list_models
4180
+ ##
4181
+ # RPC-specific configuration for `get_model`
4182
+ # @return [::Gapic::Config::Method]
4183
+ #
4184
+ attr_reader :get_model
4185
+ ##
4186
+ # RPC-specific configuration for `delete_model`
4187
+ # @return [::Gapic::Config::Method]
4188
+ #
4189
+ attr_reader :delete_model
2483
4190
 
2484
4191
  # @private
2485
4192
  def initialize parent_rpcs = nil
2486
4193
  translate_text_config = parent_rpcs.translate_text if parent_rpcs.respond_to? :translate_text
2487
4194
  @translate_text = ::Gapic::Config::Method.new translate_text_config
4195
+ romanize_text_config = parent_rpcs.romanize_text if parent_rpcs.respond_to? :romanize_text
4196
+ @romanize_text = ::Gapic::Config::Method.new romanize_text_config
2488
4197
  detect_language_config = parent_rpcs.detect_language if parent_rpcs.respond_to? :detect_language
2489
4198
  @detect_language = ::Gapic::Config::Method.new detect_language_config
2490
4199
  get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages
@@ -2497,12 +4206,32 @@ module Google
2497
4206
  @batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config
2498
4207
  create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary
2499
4208
  @create_glossary = ::Gapic::Config::Method.new create_glossary_config
4209
+ update_glossary_config = parent_rpcs.update_glossary if parent_rpcs.respond_to? :update_glossary
4210
+ @update_glossary = ::Gapic::Config::Method.new update_glossary_config
2500
4211
  list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries
2501
4212
  @list_glossaries = ::Gapic::Config::Method.new list_glossaries_config
2502
4213
  get_glossary_config = parent_rpcs.get_glossary if parent_rpcs.respond_to? :get_glossary
2503
4214
  @get_glossary = ::Gapic::Config::Method.new get_glossary_config
2504
4215
  delete_glossary_config = parent_rpcs.delete_glossary if parent_rpcs.respond_to? :delete_glossary
2505
4216
  @delete_glossary = ::Gapic::Config::Method.new delete_glossary_config
4217
+ get_glossary_entry_config = parent_rpcs.get_glossary_entry if parent_rpcs.respond_to? :get_glossary_entry
4218
+ @get_glossary_entry = ::Gapic::Config::Method.new get_glossary_entry_config
4219
+ list_glossary_entries_config = parent_rpcs.list_glossary_entries if parent_rpcs.respond_to? :list_glossary_entries
4220
+ @list_glossary_entries = ::Gapic::Config::Method.new list_glossary_entries_config
4221
+ create_glossary_entry_config = parent_rpcs.create_glossary_entry if parent_rpcs.respond_to? :create_glossary_entry
4222
+ @create_glossary_entry = ::Gapic::Config::Method.new create_glossary_entry_config
4223
+ update_glossary_entry_config = parent_rpcs.update_glossary_entry if parent_rpcs.respond_to? :update_glossary_entry
4224
+ @update_glossary_entry = ::Gapic::Config::Method.new update_glossary_entry_config
4225
+ delete_glossary_entry_config = parent_rpcs.delete_glossary_entry if parent_rpcs.respond_to? :delete_glossary_entry
4226
+ @delete_glossary_entry = ::Gapic::Config::Method.new delete_glossary_entry_config
4227
+ create_dataset_config = parent_rpcs.create_dataset if parent_rpcs.respond_to? :create_dataset
4228
+ @create_dataset = ::Gapic::Config::Method.new create_dataset_config
4229
+ get_dataset_config = parent_rpcs.get_dataset if parent_rpcs.respond_to? :get_dataset
4230
+ @get_dataset = ::Gapic::Config::Method.new get_dataset_config
4231
+ list_datasets_config = parent_rpcs.list_datasets if parent_rpcs.respond_to? :list_datasets
4232
+ @list_datasets = ::Gapic::Config::Method.new list_datasets_config
4233
+ delete_dataset_config = parent_rpcs.delete_dataset if parent_rpcs.respond_to? :delete_dataset
4234
+ @delete_dataset = ::Gapic::Config::Method.new delete_dataset_config
2506
4235
  create_adaptive_mt_dataset_config = parent_rpcs.create_adaptive_mt_dataset if parent_rpcs.respond_to? :create_adaptive_mt_dataset
2507
4236
  @create_adaptive_mt_dataset = ::Gapic::Config::Method.new create_adaptive_mt_dataset_config
2508
4237
  delete_adaptive_mt_dataset_config = parent_rpcs.delete_adaptive_mt_dataset if parent_rpcs.respond_to? :delete_adaptive_mt_dataset
@@ -2523,6 +4252,20 @@ module Google
2523
4252
  @list_adaptive_mt_files = ::Gapic::Config::Method.new list_adaptive_mt_files_config
2524
4253
  list_adaptive_mt_sentences_config = parent_rpcs.list_adaptive_mt_sentences if parent_rpcs.respond_to? :list_adaptive_mt_sentences
2525
4254
  @list_adaptive_mt_sentences = ::Gapic::Config::Method.new list_adaptive_mt_sentences_config
4255
+ import_data_config = parent_rpcs.import_data if parent_rpcs.respond_to? :import_data
4256
+ @import_data = ::Gapic::Config::Method.new import_data_config
4257
+ export_data_config = parent_rpcs.export_data if parent_rpcs.respond_to? :export_data
4258
+ @export_data = ::Gapic::Config::Method.new export_data_config
4259
+ list_examples_config = parent_rpcs.list_examples if parent_rpcs.respond_to? :list_examples
4260
+ @list_examples = ::Gapic::Config::Method.new list_examples_config
4261
+ create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model
4262
+ @create_model = ::Gapic::Config::Method.new create_model_config
4263
+ list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models
4264
+ @list_models = ::Gapic::Config::Method.new list_models_config
4265
+ get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model
4266
+ @get_model = ::Gapic::Config::Method.new get_model_config
4267
+ delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model
4268
+ @delete_model = ::Gapic::Config::Method.new delete_model_config
2526
4269
 
2527
4270
  yield self if block_given?
2528
4271
  end