google-cloud-translate-v3 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de1f355271c900cd2645945791321036faa54809da759453b828a6998d4c58b9
4
- data.tar.gz: 37442cdf328615d651afa9da9639be31f94cd42da89fd451486ba56ea672e0c4
3
+ metadata.gz: 33372dd6501c9fe6e451d60c565c8bcd64344f2f1df8e9f405d90cf9f176e102
4
+ data.tar.gz: 42824b612fa260da46291defafe29d98d845b4d620344fc30c9019223549c5e1
5
5
  SHA512:
6
- metadata.gz: e10eefa73af782890358a319f1206c3392e67adb0be23d440c33b7f10756645229b97b245a09619e0d7df768f7cf7ae309c083b623bc2c7a7d9a7682e3983cab
7
- data.tar.gz: 17025315d4d3ce8acb1d57aa79d0736050dea9adfcdef3b14a362802e0cd708dc4ff5d2a0d4a4da7ef327f22c5ad95a50669d7da463b03916cebf4b4692a35ce
6
+ metadata.gz: 38a8b216b0a9d3ae29f704b05fa2135b1cd483411030d565fc52481c55c8ddf5072efed968efb83e909f1cd6932de5df7c5530d7200fac3354ff780cb4ddaf3e
7
+ data.tar.gz: '075179c740268f59965a56883090c1e6bbe7eccbdc1b184ef93c75fa115d42ee96810677812c4b6f418bbcc6a9c4f6374537e4360fc3a37a009e174495f6fa39'
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/translate/v3/translation_service/rest"
20
+ require "google/cloud/translate/v3/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Translate
25
+ ##
26
+ # To load just the REST part of this package, including all its services, and instantiate a REST client:
27
+ #
28
+ # @example
29
+ #
30
+ # require "google/cloud/translate/v3/rest"
31
+ # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
32
+ #
33
+ module V3
34
+ end
35
+ end
36
+ end
37
+ end
@@ -209,20 +209,19 @@ module Google
209
209
  #
210
210
  # @param contents [::Array<::String>]
211
211
  # Required. The content of the input in string format.
212
- # We recommend the total content be less than 30k codepoints. The max length
213
- # of this field is 1024.
214
- # Use BatchTranslateText for larger text.
212
+ # We recommend the total content be less than 30,000 codepoints. The max
213
+ # length of this field is 1024. Use BatchTranslateText for larger text.
215
214
  # @param mime_type [::String]
216
215
  # Optional. The format of the source text, for example, "text/html",
217
216
  # "text/plain". If left blank, the MIME type defaults to "text/html".
218
217
  # @param source_language_code [::String]
219
- # Optional. The BCP-47 language code of the input text if
218
+ # Optional. The ISO-639 language code of the input text if
220
219
  # known, for example, "en-US" or "sr-Latn". Supported language codes are
221
220
  # listed in Language Support. If the source language isn't specified, the API
222
221
  # attempts to identify the source language automatically and returns the
223
222
  # source language within the response.
224
223
  # @param target_language_code [::String]
225
- # Required. The BCP-47 language code to use for translation of the input
224
+ # Required. The ISO-639 language code to use for translation of the input
226
225
  # text, set to one of the language codes listed in Language Support.
227
226
  # @param parent [::String]
228
227
  # Required. Project or location to make a call. Must refer to a caller's
@@ -583,7 +582,7 @@ module Google
583
582
  # @param options [::Gapic::CallOptions, ::Hash]
584
583
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
585
584
  #
586
- # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil)
585
+ # @overload translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil)
587
586
  # Pass arguments to `translate_document` via keyword arguments. Note that at
588
587
  # least one keyword argument is required. To specify no parameters, or to keep all
589
588
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -602,14 +601,14 @@ module Google
602
601
  # Models and glossaries must be within the same region (have the same
603
602
  # location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
604
603
  # @param source_language_code [::String]
605
- # Optional. The BCP-47 language code of the input document if known, for
604
+ # Optional. The ISO-639 language code of the input document if known, for
606
605
  # example, "en-US" or "sr-Latn". Supported language codes are listed in
607
606
  # Language Support. If the source language isn't specified, the API attempts
608
607
  # to identify the source language automatically and returns the source
609
608
  # language within the response. Source language must be specified if the
610
609
  # request contains a glossary or a custom model.
611
610
  # @param target_language_code [::String]
612
- # Required. The BCP-47 language code to use for translation of the input
611
+ # Required. The ISO-639 language code to use for translation of the input
613
612
  # document, set to one of the language codes listed in Language Support.
614
613
  # @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash]
615
614
  # Required. Input configurations.
@@ -647,6 +646,19 @@ module Google
647
646
  #
648
647
  # See https://cloud.google.com/translate/docs/advanced/labels for more
649
648
  # information.
649
+ # @param customized_attribution [::String]
650
+ # Optional. This flag is to support user customized attribution.
651
+ # If not provided, the default is `Machine Translated by Google`.
652
+ # Customized attribution should follow rules in
653
+ # https://cloud.google.com/translate/attribution#attribution_and_logos
654
+ # @param is_translate_native_pdf_only [::Boolean]
655
+ # Optional. If true, the page limit of online native pdf translation is 300
656
+ # and only native pdf pages will be translated.
657
+ # @param enable_shadow_removal_native_pdf [::Boolean]
658
+ # Optional. If true, use the text removal to remove the shadow text on
659
+ # background image for native pdf translation.
660
+ # Shadow removal feature can only be enabled when
661
+ # is_translate_native_pdf_only is false
650
662
  #
651
663
  # @yield [response, operation] Access the result along with the RPC operation
652
664
  # @yieldparam response [::Google::Cloud::Translate::V3::TranslateDocumentResponse]
@@ -809,14 +821,14 @@ module Google
809
821
  # # Call the batch_translate_text method.
810
822
  # result = client.batch_translate_text request
811
823
  #
812
- # # The returned object is of type Gapic::Operation. You can use this
813
- # # object to check the status of an operation, cancel it, or wait
814
- # # for results. Here is how to block until completion:
824
+ # # The returned object is of type Gapic::Operation. You can use it to
825
+ # # check the status of an operation, cancel it, or wait for results.
826
+ # # Here is how to wait for a response.
815
827
  # result.wait_until_done! timeout: 60
816
828
  # if result.response?
817
829
  # p result.response
818
830
  # else
819
- # puts "Error!"
831
+ # puts "No response received."
820
832
  # end
821
833
  #
822
834
  def batch_translate_text request, options = nil
@@ -880,7 +892,7 @@ module Google
880
892
  # @param options [::Gapic::CallOptions, ::Hash]
881
893
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
882
894
  #
883
- # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil)
895
+ # @overload batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil)
884
896
  # Pass arguments to `batch_translate_document` via keyword arguments. Note that at
885
897
  # least one keyword argument is required. To specify no parameters, or to keep all
886
898
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -896,11 +908,11 @@ module Google
896
908
  # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
897
909
  # error is returned.
898
910
  # @param source_language_code [::String]
899
- # Required. The BCP-47 language code of the input document if known, for
911
+ # Required. The ISO-639 language code of the input document if known, for
900
912
  # example, "en-US" or "sr-Latn". Supported language codes are listed in
901
- # Language Support (https://cloud.google.com/translate/docs/languages).
913
+ # [Language Support](https://cloud.google.com/translate/docs/languages).
902
914
  # @param target_language_codes [::Array<::String>]
903
- # Required. The BCP-47 language code to use for translation of the input
915
+ # Required. The ISO-639 language code to use for translation of the input
904
916
  # document. Specify up to 10 language codes here.
905
917
  # @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>]
906
918
  # Required. Input configurations.
@@ -940,6 +952,11 @@ module Google
940
952
  #
941
953
  # If nothing specified, output files will be in the same format as the
942
954
  # original file.
955
+ # @param customized_attribution [::String]
956
+ # Optional. This flag is to support user customized attribution.
957
+ # If not provided, the default is `Machine Translated by Google`.
958
+ # Customized attribution should follow rules in
959
+ # https://cloud.google.com/translate/attribution#attribution_and_logos
943
960
  #
944
961
  # @yield [response, operation] Access the result along with the RPC operation
945
962
  # @yieldparam response [::Gapic::Operation]
@@ -961,14 +978,14 @@ module Google
961
978
  # # Call the batch_translate_document method.
962
979
  # result = client.batch_translate_document request
963
980
  #
964
- # # The returned object is of type Gapic::Operation. You can use this
965
- # # object to check the status of an operation, cancel it, or wait
966
- # # for results. Here is how to block until completion:
981
+ # # The returned object is of type Gapic::Operation. You can use it to
982
+ # # check the status of an operation, cancel it, or wait for results.
983
+ # # Here is how to wait for a response.
967
984
  # result.wait_until_done! timeout: 60
968
985
  # if result.response?
969
986
  # p result.response
970
987
  # else
971
- # puts "Error!"
988
+ # puts "No response received."
972
989
  # end
973
990
  #
974
991
  def batch_translate_document request, options = nil
@@ -1057,14 +1074,14 @@ module Google
1057
1074
  # # Call the create_glossary method.
1058
1075
  # result = client.create_glossary request
1059
1076
  #
1060
- # # The returned object is of type Gapic::Operation. You can use this
1061
- # # object to check the status of an operation, cancel it, or wait
1062
- # # for results. Here is how to block until completion:
1077
+ # # The returned object is of type Gapic::Operation. You can use it to
1078
+ # # check the status of an operation, cancel it, or wait for results.
1079
+ # # Here is how to wait for a response.
1063
1080
  # result.wait_until_done! timeout: 60
1064
1081
  # if result.response?
1065
1082
  # p result.response
1066
1083
  # else
1067
- # puts "Error!"
1084
+ # puts "No response received."
1068
1085
  # end
1069
1086
  #
1070
1087
  def create_glossary request, options = nil
@@ -1176,13 +1193,11 @@ module Google
1176
1193
  # # Call the list_glossaries method.
1177
1194
  # result = client.list_glossaries request
1178
1195
  #
1179
- # # The returned object is of type Gapic::PagedEnumerable. You can
1180
- # # iterate over all elements by calling #each, and the enumerable
1181
- # # will lazily make API calls to fetch subsequent pages. Other
1182
- # # methods are also available for managing paging directly.
1183
- # result.each do |response|
1196
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1197
+ # # over elements, and API calls will be issued to fetch pages as needed.
1198
+ # result.each do |item|
1184
1199
  # # Each element is of type ::Google::Cloud::Translate::V3::Glossary.
1185
- # p response
1200
+ # p item
1186
1201
  # end
1187
1202
  #
1188
1203
  def list_glossaries request, options = nil
@@ -1356,14 +1371,14 @@ module Google
1356
1371
  # # Call the delete_glossary method.
1357
1372
  # result = client.delete_glossary request
1358
1373
  #
1359
- # # The returned object is of type Gapic::Operation. You can use this
1360
- # # object to check the status of an operation, cancel it, or wait
1361
- # # for results. Here is how to block until completion:
1374
+ # # The returned object is of type Gapic::Operation. You can use it to
1375
+ # # check the status of an operation, cancel it, or wait for results.
1376
+ # # Here is how to wait for a response.
1362
1377
  # result.wait_until_done! timeout: 60
1363
1378
  # if result.response?
1364
1379
  # p result.response
1365
1380
  # else
1366
- # puts "Error!"
1381
+ # puts "No response received."
1367
1382
  # end
1368
1383
  #
1369
1384
  def delete_glossary request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -567,6 +565,14 @@ module Google
567
565
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
568
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
569
567
 
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
573
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ metadata[:"x-goog-request-params"] ||= request_params_header
575
+
570
576
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
571
577
  metadata: metadata,
572
578
  retry_policy: @config.rpcs.wait_operation.retry_policy