google-apis-translate_v3 0.11.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/OVERVIEW.md +1 -1
- data/lib/google/apis/translate_v3/classes.rb +324 -2
- data/lib/google/apis/translate_v3/gem_version.rb +3 -3
- data/lib/google/apis/translate_v3/representations.rb +137 -0
- data/lib/google/apis/translate_v3/service.rb +82 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e9bd6d2b504d53ea94449ba5fc66c8cfacab732046943b50b5bec33ff23c8cf
|
4
|
+
data.tar.gz: 57818157138a878824b637343527ba948d4353e51d75db87c85ded66e401da5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c384b212337bbbe961c94f97ffbf4ae3de974324e6d121914c899bba32e80862e943d2627097b0f11127eba978137480d8ad31a25d2851d247334f2543189725
|
7
|
+
data.tar.gz: 9438bdbbc8d6722b3ee56ec72c65156546ab4a89e96d88ce2c2a6915bdd1603319ca0f760abe6485306c6ff11b2eb8108e9b2d1122730df878f74168b9122216
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Release history for google-apis-translate_v3
|
2
2
|
|
3
|
+
### v0.14.0 (2022-04-05)
|
4
|
+
|
5
|
+
* Regenerated from discovery document revision 20220401
|
6
|
+
* Regenerated using generator version 0.4.1
|
7
|
+
|
8
|
+
### v0.13.0 (2021-12-14)
|
9
|
+
|
10
|
+
* Unspecified changes
|
11
|
+
|
12
|
+
### v0.12.0 (2021-11-01)
|
13
|
+
|
14
|
+
* Regenerated from discovery document revision 20211029
|
15
|
+
|
3
16
|
### v0.11.0 (2021-10-21)
|
4
17
|
|
5
18
|
* Unspecified changes
|
data/OVERVIEW.md
CHANGED
@@ -51,7 +51,7 @@ require "google/apis/translate_v3"
|
|
51
51
|
client = Google::Apis::TranslateV3::TranslateService.new
|
52
52
|
|
53
53
|
# Authenticate calls
|
54
|
-
client.
|
54
|
+
client.authorization = # ... use the googleauth gem to create credentials
|
55
55
|
```
|
56
56
|
|
57
57
|
See the class reference docs for information on the methods you can call from a client.
|
@@ -22,6 +22,111 @@ module Google
|
|
22
22
|
module Apis
|
23
23
|
module TranslateV3
|
24
24
|
|
25
|
+
# Input configuration for BatchTranslateDocument request.
|
26
|
+
class BatchDocumentInputConfig
|
27
|
+
include Google::Apis::Core::Hashable
|
28
|
+
|
29
|
+
# The Google Cloud Storage location for the input content.
|
30
|
+
# Corresponds to the JSON property `gcsSource`
|
31
|
+
# @return [Google::Apis::TranslateV3::GcsSource]
|
32
|
+
attr_accessor :gcs_source
|
33
|
+
|
34
|
+
def initialize(**args)
|
35
|
+
update!(**args)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Update properties of this object
|
39
|
+
def update!(**args)
|
40
|
+
@gcs_source = args[:gcs_source] if args.key?(:gcs_source)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Output configuration for BatchTranslateDocument request.
|
45
|
+
class BatchDocumentOutputConfig
|
46
|
+
include Google::Apis::Core::Hashable
|
47
|
+
|
48
|
+
# The Google Cloud Storage location for the output content.
|
49
|
+
# Corresponds to the JSON property `gcsDestination`
|
50
|
+
# @return [Google::Apis::TranslateV3::GcsDestination]
|
51
|
+
attr_accessor :gcs_destination
|
52
|
+
|
53
|
+
def initialize(**args)
|
54
|
+
update!(**args)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Update properties of this object
|
58
|
+
def update!(**args)
|
59
|
+
@gcs_destination = args[:gcs_destination] if args.key?(:gcs_destination)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# The BatchTranslateDocument request.
|
64
|
+
class BatchTranslateDocumentRequest
|
65
|
+
include Google::Apis::Core::Hashable
|
66
|
+
|
67
|
+
# Optional.
|
68
|
+
# Corresponds to the JSON property `formatConversions`
|
69
|
+
# @return [Hash<String,String>]
|
70
|
+
attr_accessor :format_conversions
|
71
|
+
|
72
|
+
# Optional. Glossaries to be applied. It's keyed by target language code.
|
73
|
+
# Corresponds to the JSON property `glossaries`
|
74
|
+
# @return [Hash<String,Google::Apis::TranslateV3::TranslateTextGlossaryConfig>]
|
75
|
+
attr_accessor :glossaries
|
76
|
+
|
77
|
+
# Required. Input configurations. The total number of files matched should be <=
|
78
|
+
# 100. The total content size to translate should be <= 100M Unicode codepoints.
|
79
|
+
# The files must use UTF-8 encoding.
|
80
|
+
# Corresponds to the JSON property `inputConfigs`
|
81
|
+
# @return [Array<Google::Apis::TranslateV3::BatchDocumentInputConfig>]
|
82
|
+
attr_accessor :input_configs
|
83
|
+
|
84
|
+
# Optional. The models to use for translation. Map's key is target language code.
|
85
|
+
# Map's value is the model name. Value can be a built-in general model, or an
|
86
|
+
# AutoML Translation model. The value format depends on model type: - AutoML
|
87
|
+
# Translation models: `projects/`project-number-or-id`/locations/`location-id`/
|
88
|
+
# models/`model-id`` - General (built-in) models: `projects/`project-number-or-
|
89
|
+
# id`/locations/`location-id`/models/general/nmt`, If the map is empty or a
|
90
|
+
# specific model is not requested for a language pair, then default google model
|
91
|
+
# (nmt) is used.
|
92
|
+
# Corresponds to the JSON property `models`
|
93
|
+
# @return [Hash<String,String>]
|
94
|
+
attr_accessor :models
|
95
|
+
|
96
|
+
# Output configuration for BatchTranslateDocument request.
|
97
|
+
# Corresponds to the JSON property `outputConfig`
|
98
|
+
# @return [Google::Apis::TranslateV3::BatchDocumentOutputConfig]
|
99
|
+
attr_accessor :output_config
|
100
|
+
|
101
|
+
# Required. The BCP-47 language code of the input document if known, for example,
|
102
|
+
# "en-US" or "sr-Latn". Supported language codes are listed in Language Support
|
103
|
+
# (https://cloud.google.com/translate/docs/languages).
|
104
|
+
# Corresponds to the JSON property `sourceLanguageCode`
|
105
|
+
# @return [String]
|
106
|
+
attr_accessor :source_language_code
|
107
|
+
|
108
|
+
# Required. The BCP-47 language code to use for translation of the input
|
109
|
+
# document. Specify up to 10 language codes here.
|
110
|
+
# Corresponds to the JSON property `targetLanguageCodes`
|
111
|
+
# @return [Array<String>]
|
112
|
+
attr_accessor :target_language_codes
|
113
|
+
|
114
|
+
def initialize(**args)
|
115
|
+
update!(**args)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Update properties of this object
|
119
|
+
def update!(**args)
|
120
|
+
@format_conversions = args[:format_conversions] if args.key?(:format_conversions)
|
121
|
+
@glossaries = args[:glossaries] if args.key?(:glossaries)
|
122
|
+
@input_configs = args[:input_configs] if args.key?(:input_configs)
|
123
|
+
@models = args[:models] if args.key?(:models)
|
124
|
+
@output_config = args[:output_config] if args.key?(:output_config)
|
125
|
+
@source_language_code = args[:source_language_code] if args.key?(:source_language_code)
|
126
|
+
@target_language_codes = args[:target_language_codes] if args.key?(:target_language_codes)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
25
130
|
# The batch translation request.
|
26
131
|
class BatchTranslateTextRequest
|
27
132
|
include Google::Apis::Core::Hashable
|
@@ -198,11 +303,115 @@ module Google
|
|
198
303
|
end
|
199
304
|
end
|
200
305
|
|
306
|
+
# A document translation request input config.
|
307
|
+
class DocumentInputConfig
|
308
|
+
include Google::Apis::Core::Hashable
|
309
|
+
|
310
|
+
# Document's content represented as a stream of bytes.
|
311
|
+
# Corresponds to the JSON property `content`
|
312
|
+
# NOTE: Values are automatically base64 encoded/decoded in the client library.
|
313
|
+
# @return [String]
|
314
|
+
attr_accessor :content
|
315
|
+
|
316
|
+
# The Google Cloud Storage location for the input content.
|
317
|
+
# Corresponds to the JSON property `gcsSource`
|
318
|
+
# @return [Google::Apis::TranslateV3::GcsSource]
|
319
|
+
attr_accessor :gcs_source
|
320
|
+
|
321
|
+
# Specifies the input document's mime_type. If not specified it will be
|
322
|
+
# determined using the file extension for gcs_source provided files. For a file
|
323
|
+
# provided through bytes content the mime_type must be provided. Currently
|
324
|
+
# supported mime types are: - application/pdf - application/vnd.openxmlformats-
|
325
|
+
# officedocument.wordprocessingml.document - application/vnd.openxmlformats-
|
326
|
+
# officedocument.presentationml.presentation - application/vnd.openxmlformats-
|
327
|
+
# officedocument.spreadsheetml.sheet
|
328
|
+
# Corresponds to the JSON property `mimeType`
|
329
|
+
# @return [String]
|
330
|
+
attr_accessor :mime_type
|
331
|
+
|
332
|
+
def initialize(**args)
|
333
|
+
update!(**args)
|
334
|
+
end
|
335
|
+
|
336
|
+
# Update properties of this object
|
337
|
+
def update!(**args)
|
338
|
+
@content = args[:content] if args.key?(:content)
|
339
|
+
@gcs_source = args[:gcs_source] if args.key?(:gcs_source)
|
340
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
# A document translation request output config.
|
345
|
+
class DocumentOutputConfig
|
346
|
+
include Google::Apis::Core::Hashable
|
347
|
+
|
348
|
+
# The Google Cloud Storage location for the output content.
|
349
|
+
# Corresponds to the JSON property `gcsDestination`
|
350
|
+
# @return [Google::Apis::TranslateV3::GcsDestination]
|
351
|
+
attr_accessor :gcs_destination
|
352
|
+
|
353
|
+
# Optional. Specifies the translated document's mime_type. If not specified, the
|
354
|
+
# translated file's mime type will be the same as the input file's mime type.
|
355
|
+
# Currently only support the output mime type to be the same as input mime type.
|
356
|
+
# - application/pdf - application/vnd.openxmlformats-officedocument.
|
357
|
+
# wordprocessingml.document - application/vnd.openxmlformats-officedocument.
|
358
|
+
# presentationml.presentation - application/vnd.openxmlformats-officedocument.
|
359
|
+
# spreadsheetml.sheet
|
360
|
+
# Corresponds to the JSON property `mimeType`
|
361
|
+
# @return [String]
|
362
|
+
attr_accessor :mime_type
|
363
|
+
|
364
|
+
def initialize(**args)
|
365
|
+
update!(**args)
|
366
|
+
end
|
367
|
+
|
368
|
+
# Update properties of this object
|
369
|
+
def update!(**args)
|
370
|
+
@gcs_destination = args[:gcs_destination] if args.key?(:gcs_destination)
|
371
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
# A translated document message.
|
376
|
+
class DocumentTranslation
|
377
|
+
include Google::Apis::Core::Hashable
|
378
|
+
|
379
|
+
# The array of translated documents. It is expected to be size 1 for now. We may
|
380
|
+
# produce multiple translated documents in the future for other type of file
|
381
|
+
# formats.
|
382
|
+
# Corresponds to the JSON property `byteStreamOutputs`
|
383
|
+
# @return [Array<String>]
|
384
|
+
attr_accessor :byte_stream_outputs
|
385
|
+
|
386
|
+
# The detected language for the input document. If the user did not provide the
|
387
|
+
# source language for the input document, this field will have the language code
|
388
|
+
# automatically detected. If the source language was passed, auto-detection of
|
389
|
+
# the language does not occur and this field is empty.
|
390
|
+
# Corresponds to the JSON property `detectedLanguageCode`
|
391
|
+
# @return [String]
|
392
|
+
attr_accessor :detected_language_code
|
393
|
+
|
394
|
+
# The translated document's mime type.
|
395
|
+
# Corresponds to the JSON property `mimeType`
|
396
|
+
# @return [String]
|
397
|
+
attr_accessor :mime_type
|
398
|
+
|
399
|
+
def initialize(**args)
|
400
|
+
update!(**args)
|
401
|
+
end
|
402
|
+
|
403
|
+
# Update properties of this object
|
404
|
+
def update!(**args)
|
405
|
+
@byte_stream_outputs = args[:byte_stream_outputs] if args.key?(:byte_stream_outputs)
|
406
|
+
@detected_language_code = args[:detected_language_code] if args.key?(:detected_language_code)
|
407
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
201
411
|
# A generic empty message that you can re-use to avoid defining duplicated empty
|
202
412
|
# messages in your APIs. A typical example is to use it as the request or the
|
203
413
|
# response type of an API method. For instance: service Foo ` rpc Bar(google.
|
204
|
-
# protobuf.Empty) returns (google.protobuf.Empty); `
|
205
|
-
# `Empty` is empty JSON object ````.
|
414
|
+
# protobuf.Empty) returns (google.protobuf.Empty); `
|
206
415
|
class Empty
|
207
416
|
include Google::Apis::Core::Hashable
|
208
417
|
|
@@ -715,6 +924,119 @@ module Google
|
|
715
924
|
end
|
716
925
|
end
|
717
926
|
|
927
|
+
# A document translation request.
|
928
|
+
class TranslateDocumentRequest
|
929
|
+
include Google::Apis::Core::Hashable
|
930
|
+
|
931
|
+
# A document translation request input config.
|
932
|
+
# Corresponds to the JSON property `documentInputConfig`
|
933
|
+
# @return [Google::Apis::TranslateV3::DocumentInputConfig]
|
934
|
+
attr_accessor :document_input_config
|
935
|
+
|
936
|
+
# A document translation request output config.
|
937
|
+
# Corresponds to the JSON property `documentOutputConfig`
|
938
|
+
# @return [Google::Apis::TranslateV3::DocumentOutputConfig]
|
939
|
+
attr_accessor :document_output_config
|
940
|
+
|
941
|
+
# Configures which glossary should be used for a specific target language, and
|
942
|
+
# defines options for applying that glossary.
|
943
|
+
# Corresponds to the JSON property `glossaryConfig`
|
944
|
+
# @return [Google::Apis::TranslateV3::TranslateTextGlossaryConfig]
|
945
|
+
attr_accessor :glossary_config
|
946
|
+
|
947
|
+
# Optional. The labels with user-defined metadata for the request. Label keys
|
948
|
+
# and values can be no longer than 63 characters (Unicode codepoints), can only
|
949
|
+
# contain lowercase letters, numeric characters, underscores and dashes.
|
950
|
+
# International characters are allowed. Label values are optional. Label keys
|
951
|
+
# must start with a letter. See https://cloud.google.com/translate/docs/advanced/
|
952
|
+
# labels for more information.
|
953
|
+
# Corresponds to the JSON property `labels`
|
954
|
+
# @return [Hash<String,String>]
|
955
|
+
attr_accessor :labels
|
956
|
+
|
957
|
+
# Optional. The `model` type requested for this translation. The format depends
|
958
|
+
# on model type: - AutoML Translation models: `projects/`project-number-or-id`/
|
959
|
+
# locations/`location-id`/models/`model-id`` - General (built-in) models: `
|
960
|
+
# projects/`project-number-or-id`/locations/`location-id`/models/general/nmt`,
|
961
|
+
# If not provided, the default Google model (NMT) will be used for translation.
|
962
|
+
# Corresponds to the JSON property `model`
|
963
|
+
# @return [String]
|
964
|
+
attr_accessor :model
|
965
|
+
|
966
|
+
# Optional. The BCP-47 language code of the input document if known, for example,
|
967
|
+
# "en-US" or "sr-Latn". Supported language codes are listed in Language Support.
|
968
|
+
# If the source language isn't specified, the API attempts to identify the
|
969
|
+
# source language automatically and returns the source language within the
|
970
|
+
# response. Source language must be specified if the request contains a glossary
|
971
|
+
# or a custom model.
|
972
|
+
# Corresponds to the JSON property `sourceLanguageCode`
|
973
|
+
# @return [String]
|
974
|
+
attr_accessor :source_language_code
|
975
|
+
|
976
|
+
# Required. The BCP-47 language code to use for translation of the input
|
977
|
+
# document, set to one of the language codes listed in Language Support.
|
978
|
+
# Corresponds to the JSON property `targetLanguageCode`
|
979
|
+
# @return [String]
|
980
|
+
attr_accessor :target_language_code
|
981
|
+
|
982
|
+
def initialize(**args)
|
983
|
+
update!(**args)
|
984
|
+
end
|
985
|
+
|
986
|
+
# Update properties of this object
|
987
|
+
def update!(**args)
|
988
|
+
@document_input_config = args[:document_input_config] if args.key?(:document_input_config)
|
989
|
+
@document_output_config = args[:document_output_config] if args.key?(:document_output_config)
|
990
|
+
@glossary_config = args[:glossary_config] if args.key?(:glossary_config)
|
991
|
+
@labels = args[:labels] if args.key?(:labels)
|
992
|
+
@model = args[:model] if args.key?(:model)
|
993
|
+
@source_language_code = args[:source_language_code] if args.key?(:source_language_code)
|
994
|
+
@target_language_code = args[:target_language_code] if args.key?(:target_language_code)
|
995
|
+
end
|
996
|
+
end
|
997
|
+
|
998
|
+
# A translated document response message.
|
999
|
+
class TranslateDocumentResponse
|
1000
|
+
include Google::Apis::Core::Hashable
|
1001
|
+
|
1002
|
+
# A translated document message.
|
1003
|
+
# Corresponds to the JSON property `documentTranslation`
|
1004
|
+
# @return [Google::Apis::TranslateV3::DocumentTranslation]
|
1005
|
+
attr_accessor :document_translation
|
1006
|
+
|
1007
|
+
# Configures which glossary should be used for a specific target language, and
|
1008
|
+
# defines options for applying that glossary.
|
1009
|
+
# Corresponds to the JSON property `glossaryConfig`
|
1010
|
+
# @return [Google::Apis::TranslateV3::TranslateTextGlossaryConfig]
|
1011
|
+
attr_accessor :glossary_config
|
1012
|
+
|
1013
|
+
# A translated document message.
|
1014
|
+
# Corresponds to the JSON property `glossaryDocumentTranslation`
|
1015
|
+
# @return [Google::Apis::TranslateV3::DocumentTranslation]
|
1016
|
+
attr_accessor :glossary_document_translation
|
1017
|
+
|
1018
|
+
# Only present when 'model' is present in the request. 'model' is normalized to
|
1019
|
+
# have a project number. For example: If the 'model' field in
|
1020
|
+
# TranslateDocumentRequest is: `projects/`project-id`/locations/`location-id`/
|
1021
|
+
# models/general/nmt` then `model` here would be normalized to `projects/`
|
1022
|
+
# project-number`/locations/`location-id`/models/general/nmt`.
|
1023
|
+
# Corresponds to the JSON property `model`
|
1024
|
+
# @return [String]
|
1025
|
+
attr_accessor :model
|
1026
|
+
|
1027
|
+
def initialize(**args)
|
1028
|
+
update!(**args)
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
# Update properties of this object
|
1032
|
+
def update!(**args)
|
1033
|
+
@document_translation = args[:document_translation] if args.key?(:document_translation)
|
1034
|
+
@glossary_config = args[:glossary_config] if args.key?(:glossary_config)
|
1035
|
+
@glossary_document_translation = args[:glossary_document_translation] if args.key?(:glossary_document_translation)
|
1036
|
+
@model = args[:model] if args.key?(:model)
|
1037
|
+
end
|
1038
|
+
end
|
1039
|
+
|
718
1040
|
# Configures which glossary should be used for a specific target language, and
|
719
1041
|
# defines options for applying that glossary.
|
720
1042
|
class TranslateTextGlossaryConfig
|
@@ -16,13 +16,13 @@ module Google
|
|
16
16
|
module Apis
|
17
17
|
module TranslateV3
|
18
18
|
# Version of the google-apis-translate_v3 gem
|
19
|
-
GEM_VERSION = "0.
|
19
|
+
GEM_VERSION = "0.14.0"
|
20
20
|
|
21
21
|
# Version of the code generator used to generate this client
|
22
|
-
GENERATOR_VERSION = "0.4.
|
22
|
+
GENERATOR_VERSION = "0.4.1"
|
23
23
|
|
24
24
|
# Revision of the discovery document this client was generated from
|
25
|
-
REVISION = "
|
25
|
+
REVISION = "20220401"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -22,6 +22,24 @@ module Google
|
|
22
22
|
module Apis
|
23
23
|
module TranslateV3
|
24
24
|
|
25
|
+
class BatchDocumentInputConfig
|
26
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
27
|
+
|
28
|
+
include Google::Apis::Core::JsonObjectSupport
|
29
|
+
end
|
30
|
+
|
31
|
+
class BatchDocumentOutputConfig
|
32
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
33
|
+
|
34
|
+
include Google::Apis::Core::JsonObjectSupport
|
35
|
+
end
|
36
|
+
|
37
|
+
class BatchTranslateDocumentRequest
|
38
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
39
|
+
|
40
|
+
include Google::Apis::Core::JsonObjectSupport
|
41
|
+
end
|
42
|
+
|
25
43
|
class BatchTranslateTextRequest
|
26
44
|
class Representation < Google::Apis::Core::JsonRepresentation; end
|
27
45
|
|
@@ -52,6 +70,24 @@ module Google
|
|
52
70
|
include Google::Apis::Core::JsonObjectSupport
|
53
71
|
end
|
54
72
|
|
73
|
+
class DocumentInputConfig
|
74
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
75
|
+
|
76
|
+
include Google::Apis::Core::JsonObjectSupport
|
77
|
+
end
|
78
|
+
|
79
|
+
class DocumentOutputConfig
|
80
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
81
|
+
|
82
|
+
include Google::Apis::Core::JsonObjectSupport
|
83
|
+
end
|
84
|
+
|
85
|
+
class DocumentTranslation
|
86
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
87
|
+
|
88
|
+
include Google::Apis::Core::JsonObjectSupport
|
89
|
+
end
|
90
|
+
|
55
91
|
class Empty
|
56
92
|
class Representation < Google::Apis::Core::JsonRepresentation; end
|
57
93
|
|
@@ -154,6 +190,18 @@ module Google
|
|
154
190
|
include Google::Apis::Core::JsonObjectSupport
|
155
191
|
end
|
156
192
|
|
193
|
+
class TranslateDocumentRequest
|
194
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
195
|
+
|
196
|
+
include Google::Apis::Core::JsonObjectSupport
|
197
|
+
end
|
198
|
+
|
199
|
+
class TranslateDocumentResponse
|
200
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
201
|
+
|
202
|
+
include Google::Apis::Core::JsonObjectSupport
|
203
|
+
end
|
204
|
+
|
157
205
|
class TranslateTextGlossaryConfig
|
158
206
|
class Representation < Google::Apis::Core::JsonRepresentation; end
|
159
207
|
|
@@ -184,6 +232,38 @@ module Google
|
|
184
232
|
include Google::Apis::Core::JsonObjectSupport
|
185
233
|
end
|
186
234
|
|
235
|
+
class BatchDocumentInputConfig
|
236
|
+
# @private
|
237
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
238
|
+
property :gcs_source, as: 'gcsSource', class: Google::Apis::TranslateV3::GcsSource, decorator: Google::Apis::TranslateV3::GcsSource::Representation
|
239
|
+
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
class BatchDocumentOutputConfig
|
244
|
+
# @private
|
245
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
246
|
+
property :gcs_destination, as: 'gcsDestination', class: Google::Apis::TranslateV3::GcsDestination, decorator: Google::Apis::TranslateV3::GcsDestination::Representation
|
247
|
+
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
class BatchTranslateDocumentRequest
|
252
|
+
# @private
|
253
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
254
|
+
hash :format_conversions, as: 'formatConversions'
|
255
|
+
hash :glossaries, as: 'glossaries', class: Google::Apis::TranslateV3::TranslateTextGlossaryConfig, decorator: Google::Apis::TranslateV3::TranslateTextGlossaryConfig::Representation
|
256
|
+
|
257
|
+
collection :input_configs, as: 'inputConfigs', class: Google::Apis::TranslateV3::BatchDocumentInputConfig, decorator: Google::Apis::TranslateV3::BatchDocumentInputConfig::Representation
|
258
|
+
|
259
|
+
hash :models, as: 'models'
|
260
|
+
property :output_config, as: 'outputConfig', class: Google::Apis::TranslateV3::BatchDocumentOutputConfig, decorator: Google::Apis::TranslateV3::BatchDocumentOutputConfig::Representation
|
261
|
+
|
262
|
+
property :source_language_code, as: 'sourceLanguageCode'
|
263
|
+
collection :target_language_codes, as: 'targetLanguageCodes'
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
187
267
|
class BatchTranslateTextRequest
|
188
268
|
# @private
|
189
269
|
class Representation < Google::Apis::Core::JsonRepresentation
|
@@ -232,6 +312,34 @@ module Google
|
|
232
312
|
end
|
233
313
|
end
|
234
314
|
|
315
|
+
class DocumentInputConfig
|
316
|
+
# @private
|
317
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
318
|
+
property :content, :base64 => true, as: 'content'
|
319
|
+
property :gcs_source, as: 'gcsSource', class: Google::Apis::TranslateV3::GcsSource, decorator: Google::Apis::TranslateV3::GcsSource::Representation
|
320
|
+
|
321
|
+
property :mime_type, as: 'mimeType'
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
class DocumentOutputConfig
|
326
|
+
# @private
|
327
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
328
|
+
property :gcs_destination, as: 'gcsDestination', class: Google::Apis::TranslateV3::GcsDestination, decorator: Google::Apis::TranslateV3::GcsDestination::Representation
|
329
|
+
|
330
|
+
property :mime_type, as: 'mimeType'
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
class DocumentTranslation
|
335
|
+
# @private
|
336
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
337
|
+
collection :byte_stream_outputs, as: 'byteStreamOutputs'
|
338
|
+
property :detected_language_code, as: 'detectedLanguageCode'
|
339
|
+
property :mime_type, as: 'mimeType'
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
235
343
|
class Empty
|
236
344
|
# @private
|
237
345
|
class Representation < Google::Apis::Core::JsonRepresentation
|
@@ -385,6 +493,35 @@ module Google
|
|
385
493
|
end
|
386
494
|
end
|
387
495
|
|
496
|
+
class TranslateDocumentRequest
|
497
|
+
# @private
|
498
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
499
|
+
property :document_input_config, as: 'documentInputConfig', class: Google::Apis::TranslateV3::DocumentInputConfig, decorator: Google::Apis::TranslateV3::DocumentInputConfig::Representation
|
500
|
+
|
501
|
+
property :document_output_config, as: 'documentOutputConfig', class: Google::Apis::TranslateV3::DocumentOutputConfig, decorator: Google::Apis::TranslateV3::DocumentOutputConfig::Representation
|
502
|
+
|
503
|
+
property :glossary_config, as: 'glossaryConfig', class: Google::Apis::TranslateV3::TranslateTextGlossaryConfig, decorator: Google::Apis::TranslateV3::TranslateTextGlossaryConfig::Representation
|
504
|
+
|
505
|
+
hash :labels, as: 'labels'
|
506
|
+
property :model, as: 'model'
|
507
|
+
property :source_language_code, as: 'sourceLanguageCode'
|
508
|
+
property :target_language_code, as: 'targetLanguageCode'
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
class TranslateDocumentResponse
|
513
|
+
# @private
|
514
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
515
|
+
property :document_translation, as: 'documentTranslation', class: Google::Apis::TranslateV3::DocumentTranslation, decorator: Google::Apis::TranslateV3::DocumentTranslation::Representation
|
516
|
+
|
517
|
+
property :glossary_config, as: 'glossaryConfig', class: Google::Apis::TranslateV3::TranslateTextGlossaryConfig, decorator: Google::Apis::TranslateV3::TranslateTextGlossaryConfig::Representation
|
518
|
+
|
519
|
+
property :glossary_document_translation, as: 'glossaryDocumentTranslation', class: Google::Apis::TranslateV3::DocumentTranslation, decorator: Google::Apis::TranslateV3::DocumentTranslation::Representation
|
520
|
+
|
521
|
+
property :model, as: 'model'
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
388
525
|
class TranslateTextGlossaryConfig
|
389
526
|
# @private
|
390
527
|
class Representation < Google::Apis::Core::JsonRepresentation
|
@@ -175,6 +175,48 @@ module Google
|
|
175
175
|
execute_or_queue_command(command, &block)
|
176
176
|
end
|
177
177
|
|
178
|
+
# Translates a large volume of document in asynchronous batch mode. This
|
179
|
+
# function provides real-time output as the inputs are being processed. If
|
180
|
+
# caller cancels a request, the partial results (for an input file, it's all or
|
181
|
+
# nothing) may still be available on the specified output location. This call
|
182
|
+
# returns immediately and you can use google.longrunning.Operation.name to poll
|
183
|
+
# the status of the call.
|
184
|
+
# @param [String] parent
|
185
|
+
# Required. Location to make a regional call. Format: `projects/`project-number-
|
186
|
+
# or-id`/locations/`location-id``. The `global` location is not supported for
|
187
|
+
# batch translation. Only AutoML Translation models or glossaries within the
|
188
|
+
# same region (have the same location-id) can be used, otherwise an
|
189
|
+
# INVALID_ARGUMENT (400) error is returned.
|
190
|
+
# @param [Google::Apis::TranslateV3::BatchTranslateDocumentRequest] batch_translate_document_request_object
|
191
|
+
# @param [String] fields
|
192
|
+
# Selector specifying which fields to include in a partial response.
|
193
|
+
# @param [String] quota_user
|
194
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
195
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
196
|
+
# @param [Google::Apis::RequestOptions] options
|
197
|
+
# Request-specific options
|
198
|
+
#
|
199
|
+
# @yield [result, err] Result & error if block supplied
|
200
|
+
# @yieldparam result [Google::Apis::TranslateV3::Operation] parsed result object
|
201
|
+
# @yieldparam err [StandardError] error object if request failed
|
202
|
+
#
|
203
|
+
# @return [Google::Apis::TranslateV3::Operation]
|
204
|
+
#
|
205
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
206
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
207
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
208
|
+
def batch_location_translate_document(parent, batch_translate_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
209
|
+
command = make_simple_command(:post, 'v3/{+parent}:batchTranslateDocument', options)
|
210
|
+
command.request_representation = Google::Apis::TranslateV3::BatchTranslateDocumentRequest::Representation
|
211
|
+
command.request_object = batch_translate_document_request_object
|
212
|
+
command.response_representation = Google::Apis::TranslateV3::Operation::Representation
|
213
|
+
command.response_class = Google::Apis::TranslateV3::Operation
|
214
|
+
command.params['parent'] = parent unless parent.nil?
|
215
|
+
command.query['fields'] = fields unless fields.nil?
|
216
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
217
|
+
execute_or_queue_command(command, &block)
|
218
|
+
end
|
219
|
+
|
178
220
|
# Translates a large volume of text in asynchronous batch mode. This function
|
179
221
|
# provides real-time output as the inputs are being processed. If caller cancels
|
180
222
|
# a request, the partial results (for an input file, it's all or nothing) may
|
@@ -339,8 +381,8 @@ module Google
|
|
339
381
|
# The resource that owns the locations collection, if applicable.
|
340
382
|
# @param [String] filter
|
341
383
|
# A filter to narrow down results to a preferred subset. The filtering language
|
342
|
-
# accepts strings like "displayName=tokyo"
|
343
|
-
# AIP-160](https://google.aip.dev/160).
|
384
|
+
# accepts strings like `"displayName=tokyo"`, and is documented in more detail
|
385
|
+
# in [AIP-160](https://google.aip.dev/160).
|
344
386
|
# @param [Fixnum] page_size
|
345
387
|
# The maximum number of results to return. If not set, the service selects a
|
346
388
|
# default.
|
@@ -377,6 +419,44 @@ module Google
|
|
377
419
|
execute_or_queue_command(command, &block)
|
378
420
|
end
|
379
421
|
|
422
|
+
# Translates documents in synchronous mode.
|
423
|
+
# @param [String] parent
|
424
|
+
# Required. Location to make a regional call. Format: `projects/`project-number-
|
425
|
+
# or-id`/locations/`location-id``. For global calls, use `projects/`project-
|
426
|
+
# number-or-id`/locations/global` or `projects/`project-number-or-id``. Non-
|
427
|
+
# global location is required for requests using AutoML models or custom
|
428
|
+
# glossaries. Models and glossaries must be within the same region (have the
|
429
|
+
# same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
430
|
+
# @param [Google::Apis::TranslateV3::TranslateDocumentRequest] translate_document_request_object
|
431
|
+
# @param [String] fields
|
432
|
+
# Selector specifying which fields to include in a partial response.
|
433
|
+
# @param [String] quota_user
|
434
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
435
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
436
|
+
# @param [Google::Apis::RequestOptions] options
|
437
|
+
# Request-specific options
|
438
|
+
#
|
439
|
+
# @yield [result, err] Result & error if block supplied
|
440
|
+
# @yieldparam result [Google::Apis::TranslateV3::TranslateDocumentResponse] parsed result object
|
441
|
+
# @yieldparam err [StandardError] error object if request failed
|
442
|
+
#
|
443
|
+
# @return [Google::Apis::TranslateV3::TranslateDocumentResponse]
|
444
|
+
#
|
445
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
446
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
447
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
448
|
+
def translate_location_document(parent, translate_document_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
449
|
+
command = make_simple_command(:post, 'v3/{+parent}:translateDocument', options)
|
450
|
+
command.request_representation = Google::Apis::TranslateV3::TranslateDocumentRequest::Representation
|
451
|
+
command.request_object = translate_document_request_object
|
452
|
+
command.response_representation = Google::Apis::TranslateV3::TranslateDocumentResponse::Representation
|
453
|
+
command.response_class = Google::Apis::TranslateV3::TranslateDocumentResponse
|
454
|
+
command.params['parent'] = parent unless parent.nil?
|
455
|
+
command.query['fields'] = fields unless fields.nil?
|
456
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
457
|
+
execute_or_queue_command(command, &block)
|
458
|
+
end
|
459
|
+
|
380
460
|
# Translates input text and returns translated text.
|
381
461
|
# @param [String] parent
|
382
462
|
# Required. Project or location to make a call. Must refer to a caller's project.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-apis-translate_v3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-apis-core
|
@@ -58,7 +58,7 @@ licenses:
|
|
58
58
|
metadata:
|
59
59
|
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
60
60
|
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/generated/google-apis-translate_v3/CHANGELOG.md
|
61
|
-
documentation_uri: https://googleapis.dev/ruby/google-apis-translate_v3/v0.
|
61
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-translate_v3/v0.14.0
|
62
62
|
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/generated/google-apis-translate_v3
|
63
63
|
post_install_message:
|
64
64
|
rdoc_options: []
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.3.5
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Simple REST client for Cloud Translation API V3
|