google-apis-translate_v3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ecc04499f6bd8f7c43bea66f9d29aedc5af50052799199fe643189cc9a50d3da
4
+ data.tar.gz: 6e5d5230b984fa7535852c6f0b46ad89a5e4629024eb2bc0c680007f10774092
5
+ SHA512:
6
+ metadata.gz: 6160f9e2656a38a3613cdc528b643a1c02c221a30df17241319890c3d375287745aeee30266993b519e27be4646ebd7a5bf8427b2f99cf404be18c678eda7314
7
+ data.tar.gz: 12ab6f1e824d9e955ca3857b2c7d37ad1133161b5535005f187de44abcf397b1bd95317068d6240398da3f230ae8a8d4a45488980a3f4d0d3cfeb49026f9505e
@@ -0,0 +1,13 @@
1
+ --hide-void-return
2
+ --no-private
3
+ --verbose
4
+ --title=google-apis-translate_v3
5
+ --markup-provider=redcarpet
6
+ --markup=markdown
7
+ --main OVERVIEW.md
8
+ lib/google/apis/translate_v3/*.rb
9
+ lib/google/apis/translate_v3.rb
10
+ -
11
+ OVERVIEW.md
12
+ CHANGELOG.md
13
+ LICENSE.md
@@ -0,0 +1,7 @@
1
+ # Release history for google-apis-translate_v3
2
+
3
+ ### v0.1.0 (2021-01-07)
4
+
5
+ * Regenerated using generator version 0.1.1
6
+ * Regenerated from discovery document revision 20201204
7
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,96 @@
1
+ # Simple REST client for version V3 of the Cloud Translation API
2
+
3
+ This is a simple client library for version V3 of the Cloud Translation API. It provides:
4
+
5
+ * A client object that connects to the HTTP/JSON REST endpoint for the service.
6
+ * Ruby objects for data structures related to the service.
7
+ * Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.
8
+ * Control of retry, pagination, and timeouts.
9
+
10
+ Note that although this client library is supported and will continue to be updated to track changes to the service, it is otherwise considered complete and not under active development. Many Google services, especially Google Cloud Platform services, may provide a more modern client that is under more active development and improvement. See the section below titled *Which client should I use?* for more information.
11
+
12
+ ## Getting started
13
+
14
+ ### Before you begin
15
+
16
+ There are a few setup steps you need to complete before you can use this library:
17
+
18
+ 1. If you don't already have a Google account, [sign up](https://www.google.com/accounts).
19
+ 2. If you have never created a Google APIs Console project, read about [Managing Projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects) and create a project in the [Google API Console](https://console.cloud.google.com/).
20
+ 3. Most APIs need to be enabled for your project. [Enable it](https://console.cloud.google.com/apis/library/translate.googleapis.com) in the console.
21
+
22
+ ### Installation
23
+
24
+ Add this line to your application's Gemfile:
25
+
26
+ ```ruby
27
+ gem 'google-apis-translate_v3', '~> 0.1'
28
+ ```
29
+
30
+ And then execute:
31
+
32
+ ```
33
+ $ bundle
34
+ ```
35
+
36
+ Or install it yourself as:
37
+
38
+ ```
39
+ $ gem install google-apis-translate_v3
40
+ ```
41
+
42
+ ### Creating a client object
43
+
44
+ Once the gem is installed, you can load the client code and instantiate a client.
45
+
46
+ ```ruby
47
+ # Load the client
48
+ require "google/apis/translate_v3"
49
+
50
+ # Create a client object
51
+ client = Google::Apis::TranslateV3::TranslateService.new
52
+
53
+ # Authenticate calls
54
+ client.authentication = # ... use the googleauth gem to create credentials
55
+ ```
56
+
57
+ See the class reference docs for information on the methods you can call from a client.
58
+
59
+ ## Documentation
60
+
61
+ More detailed descriptions of the Google simple REST clients are available in two documents.
62
+
63
+ * The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
64
+ * The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/master/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
65
+
66
+ (Note: the above documents are written for the simple REST clients in general, and their examples may not reflect the Translate service in particular.)
67
+
68
+ For reference information on specific calls in the Cloud Translation API, see the {Google::Apis::TranslateV3::TranslateService class reference docs}.
69
+
70
+ ## Which client should I use?
71
+
72
+ Google provides two types of Ruby API client libraries: **simple REST clients** and **modern clients**.
73
+
74
+ This library, `google-apis-translate_v3`, is a simple REST client. You can identify these clients by their gem names, which are always in the form `google-apis-<servicename>_<serviceversion>`. The simple REST clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.
75
+
76
+ Modern clients are produced by a modern code generator, sometimes combined with hand-crafted functionality. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Google Cloud Platform services, but do not yet support all the services covered by the simple clients.
77
+
78
+ Gem names for modern clients are often of the form `google-cloud-<service_name>`. (For example, [google-cloud-pubsub](https://rubygems.org/gems/google-cloud-pubsub).) Note that most modern clients also have corresponding "versioned" gems with names like `google-cloud-<service_name>-<version>`. (For example, [google-cloud-pubsub-v1](https://rubygems.org/gems/google-cloud-pubsub-v1).) The "versioned" gems can be used directly, but often provide lower-level interfaces. In most cases, the main gem is recommended.
79
+
80
+ **For most users, we recommend the modern client, if one is available.** Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.
81
+
82
+ The [product documentation](https://cloud.google.com/translate/docs/quickstarts) may provide guidance regarding the preferred client library to use.
83
+
84
+ ## Supported Ruby versions
85
+
86
+ This library is supported on Ruby 2.5+.
87
+
88
+ Google provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.5 and later. Older versions of Ruby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.
89
+
90
+ ## License
91
+
92
+ This library is licensed under Apache 2.0. Full license text is available in the {file:LICENSE.md LICENSE}.
93
+
94
+ ## Support
95
+
96
+ Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).
@@ -0,0 +1,15 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "google/apis/translate_v3"
@@ -0,0 +1,39 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/translate_v3/service.rb'
16
+ require 'google/apis/translate_v3/classes.rb'
17
+ require 'google/apis/translate_v3/representations.rb'
18
+ require 'google/apis/translate_v3/gem_version.rb'
19
+
20
+ module Google
21
+ module Apis
22
+ # Cloud Translation API
23
+ #
24
+ # Integrates text translation into your website or application.
25
+ #
26
+ # @see https://cloud.google.com/translate/docs/quickstarts
27
+ module TranslateV3
28
+ # Version of the Cloud Translation API this client connects to.
29
+ # This is NOT the gem version.
30
+ VERSION = 'V3'
31
+
32
+ # View and manage your data across Google Cloud Platform services
33
+ AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
34
+
35
+ # Translate text from one language to another using Google Translate
36
+ AUTH_CLOUD_TRANSLATION = 'https://www.googleapis.com/auth/cloud-translation'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,920 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module TranslateV3
24
+
25
+ # The batch translation request.
26
+ class BatchTranslateTextRequest
27
+ include Google::Apis::Core::Hashable
28
+
29
+ # Optional. Glossaries to be applied for translation. It's keyed by target
30
+ # language code.
31
+ # Corresponds to the JSON property `glossaries`
32
+ # @return [Hash<String,Google::Apis::TranslateV3::TranslateTextGlossaryConfig>]
33
+ attr_accessor :glossaries
34
+
35
+ # Required. Input configurations. The total number of files matched should be <=
36
+ # 100. The total content size should be <= 100M Unicode codepoints. The files
37
+ # must use UTF-8 encoding.
38
+ # Corresponds to the JSON property `inputConfigs`
39
+ # @return [Array<Google::Apis::TranslateV3::InputConfig>]
40
+ attr_accessor :input_configs
41
+
42
+ # Optional. The labels with user-defined metadata for the request. Label keys
43
+ # and values can be no longer than 63 characters (Unicode codepoints), can only
44
+ # contain lowercase letters, numeric characters, underscores and dashes.
45
+ # International characters are allowed. Label values are optional. Label keys
46
+ # must start with a letter. See https://cloud.google.com/translate/docs/advanced/
47
+ # labels for more information.
48
+ # Corresponds to the JSON property `labels`
49
+ # @return [Hash<String,String>]
50
+ attr_accessor :labels
51
+
52
+ # Optional. The models to use for translation. Map's key is target language code.
53
+ # Map's value is model name. Value can be a built-in general model, or an
54
+ # AutoML Translation model. The value format depends on model type: - AutoML
55
+ # Translation models: `projects/`project-number-or-id`/locations/`location-id`/
56
+ # models/`model-id`` - General (built-in) models: `projects/`project-number-or-
57
+ # id`/locations/`location-id`/models/general/nmt`, `projects/`project-number-or-
58
+ # id`/locations/`location-id`/models/general/base` If the map is empty or a
59
+ # specific model is not requested for a language pair, then default google model
60
+ # (nmt) is used.
61
+ # Corresponds to the JSON property `models`
62
+ # @return [Hash<String,String>]
63
+ attr_accessor :models
64
+
65
+ # Output configuration for BatchTranslateText request.
66
+ # Corresponds to the JSON property `outputConfig`
67
+ # @return [Google::Apis::TranslateV3::OutputConfig]
68
+ attr_accessor :output_config
69
+
70
+ # Required. Source language code.
71
+ # Corresponds to the JSON property `sourceLanguageCode`
72
+ # @return [String]
73
+ attr_accessor :source_language_code
74
+
75
+ # Required. Specify up to 10 language codes here.
76
+ # Corresponds to the JSON property `targetLanguageCodes`
77
+ # @return [Array<String>]
78
+ attr_accessor :target_language_codes
79
+
80
+ def initialize(**args)
81
+ update!(**args)
82
+ end
83
+
84
+ # Update properties of this object
85
+ def update!(**args)
86
+ @glossaries = args[:glossaries] if args.key?(:glossaries)
87
+ @input_configs = args[:input_configs] if args.key?(:input_configs)
88
+ @labels = args[:labels] if args.key?(:labels)
89
+ @models = args[:models] if args.key?(:models)
90
+ @output_config = args[:output_config] if args.key?(:output_config)
91
+ @source_language_code = args[:source_language_code] if args.key?(:source_language_code)
92
+ @target_language_codes = args[:target_language_codes] if args.key?(:target_language_codes)
93
+ end
94
+ end
95
+
96
+ # The request message for Operations.CancelOperation.
97
+ class CancelOperationRequest
98
+ include Google::Apis::Core::Hashable
99
+
100
+ def initialize(**args)
101
+ update!(**args)
102
+ end
103
+
104
+ # Update properties of this object
105
+ def update!(**args)
106
+ end
107
+ end
108
+
109
+ # The request message for language detection.
110
+ class DetectLanguageRequest
111
+ include Google::Apis::Core::Hashable
112
+
113
+ # The content of the input stored as a string.
114
+ # Corresponds to the JSON property `content`
115
+ # @return [String]
116
+ attr_accessor :content
117
+
118
+ # Optional. The labels with user-defined metadata for the request. Label keys
119
+ # and values can be no longer than 63 characters (Unicode codepoints), can only
120
+ # contain lowercase letters, numeric characters, underscores and dashes.
121
+ # International characters are allowed. Label values are optional. Label keys
122
+ # must start with a letter. See https://cloud.google.com/translate/docs/advanced/
123
+ # labels for more information.
124
+ # Corresponds to the JSON property `labels`
125
+ # @return [Hash<String,String>]
126
+ attr_accessor :labels
127
+
128
+ # Optional. The format of the source text, for example, "text/html", "text/plain"
129
+ # . If left blank, the MIME type defaults to "text/html".
130
+ # Corresponds to the JSON property `mimeType`
131
+ # @return [String]
132
+ attr_accessor :mime_type
133
+
134
+ # Optional. The language detection model to be used. Format: `projects/`project-
135
+ # number-or-id`/locations/`location-id`/models/language-detection/`model-id``
136
+ # Only one language detection model is currently supported: `projects/`project-
137
+ # number-or-id`/locations/`location-id`/models/language-detection/default`. If
138
+ # not specified, the default model is used.
139
+ # Corresponds to the JSON property `model`
140
+ # @return [String]
141
+ attr_accessor :model
142
+
143
+ def initialize(**args)
144
+ update!(**args)
145
+ end
146
+
147
+ # Update properties of this object
148
+ def update!(**args)
149
+ @content = args[:content] if args.key?(:content)
150
+ @labels = args[:labels] if args.key?(:labels)
151
+ @mime_type = args[:mime_type] if args.key?(:mime_type)
152
+ @model = args[:model] if args.key?(:model)
153
+ end
154
+ end
155
+
156
+ # The response message for language detection.
157
+ class DetectLanguageResponse
158
+ include Google::Apis::Core::Hashable
159
+
160
+ # The most probable language detected by the Translation API. For each request,
161
+ # the Translation API will always return only one result.
162
+ # Corresponds to the JSON property `languages`
163
+ # @return [Array<Google::Apis::TranslateV3::DetectedLanguage>]
164
+ attr_accessor :languages
165
+
166
+ def initialize(**args)
167
+ update!(**args)
168
+ end
169
+
170
+ # Update properties of this object
171
+ def update!(**args)
172
+ @languages = args[:languages] if args.key?(:languages)
173
+ end
174
+ end
175
+
176
+ # The response message for language detection.
177
+ class DetectedLanguage
178
+ include Google::Apis::Core::Hashable
179
+
180
+ # The confidence of the detection result for this language.
181
+ # Corresponds to the JSON property `confidence`
182
+ # @return [Float]
183
+ attr_accessor :confidence
184
+
185
+ # The BCP-47 language code of source content in the request, detected
186
+ # automatically.
187
+ # Corresponds to the JSON property `languageCode`
188
+ # @return [String]
189
+ attr_accessor :language_code
190
+
191
+ def initialize(**args)
192
+ update!(**args)
193
+ end
194
+
195
+ # Update properties of this object
196
+ def update!(**args)
197
+ @confidence = args[:confidence] if args.key?(:confidence)
198
+ @language_code = args[:language_code] if args.key?(:language_code)
199
+ end
200
+ end
201
+
202
+ # A generic empty message that you can re-use to avoid defining duplicated empty
203
+ # messages in your APIs. A typical example is to use it as the request or the
204
+ # response type of an API method. For instance: service Foo ` rpc Bar(google.
205
+ # protobuf.Empty) returns (google.protobuf.Empty); ` The JSON representation for
206
+ # `Empty` is empty JSON object ````.
207
+ class Empty
208
+ include Google::Apis::Core::Hashable
209
+
210
+ def initialize(**args)
211
+ update!(**args)
212
+ end
213
+
214
+ # Update properties of this object
215
+ def update!(**args)
216
+ end
217
+ end
218
+
219
+ # The Google Cloud Storage location for the output content.
220
+ class GcsDestination
221
+ include Google::Apis::Core::Hashable
222
+
223
+ # Required. The bucket used in 'output_uri_prefix' must exist and there must be
224
+ # no files under 'output_uri_prefix'. 'output_uri_prefix' must end with "/" and
225
+ # start with "gs://". One 'output_uri_prefix' can only be used by one batch
226
+ # translation job at a time. Otherwise an INVALID_ARGUMENT (400) error is
227
+ # returned.
228
+ # Corresponds to the JSON property `outputUriPrefix`
229
+ # @return [String]
230
+ attr_accessor :output_uri_prefix
231
+
232
+ def initialize(**args)
233
+ update!(**args)
234
+ end
235
+
236
+ # Update properties of this object
237
+ def update!(**args)
238
+ @output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)
239
+ end
240
+ end
241
+
242
+ # The Google Cloud Storage location for the input content.
243
+ class GcsSource
244
+ include Google::Apis::Core::Hashable
245
+
246
+ # Required. Source data URI. For example, `gs://my_bucket/my_object`.
247
+ # Corresponds to the JSON property `inputUri`
248
+ # @return [String]
249
+ attr_accessor :input_uri
250
+
251
+ def initialize(**args)
252
+ update!(**args)
253
+ end
254
+
255
+ # Update properties of this object
256
+ def update!(**args)
257
+ @input_uri = args[:input_uri] if args.key?(:input_uri)
258
+ end
259
+ end
260
+
261
+ # Represents a glossary built from user provided data.
262
+ class Glossary
263
+ include Google::Apis::Core::Hashable
264
+
265
+ # Output only. When the glossary creation was finished.
266
+ # Corresponds to the JSON property `endTime`
267
+ # @return [String]
268
+ attr_accessor :end_time
269
+
270
+ # Output only. The number of entries defined in the glossary.
271
+ # Corresponds to the JSON property `entryCount`
272
+ # @return [Fixnum]
273
+ attr_accessor :entry_count
274
+
275
+ # Input configuration for glossaries.
276
+ # Corresponds to the JSON property `inputConfig`
277
+ # @return [Google::Apis::TranslateV3::GlossaryInputConfig]
278
+ attr_accessor :input_config
279
+
280
+ # Used with equivalent term set glossaries.
281
+ # Corresponds to the JSON property `languageCodesSet`
282
+ # @return [Google::Apis::TranslateV3::LanguageCodesSet]
283
+ attr_accessor :language_codes_set
284
+
285
+ # Used with unidirectional glossaries.
286
+ # Corresponds to the JSON property `languagePair`
287
+ # @return [Google::Apis::TranslateV3::LanguageCodePair]
288
+ attr_accessor :language_pair
289
+
290
+ # Required. The resource name of the glossary. Glossary names have the form `
291
+ # projects/`project-number-or-id`/locations/`location-id`/glossaries/`glossary-
292
+ # id``.
293
+ # Corresponds to the JSON property `name`
294
+ # @return [String]
295
+ attr_accessor :name
296
+
297
+ # Output only. When CreateGlossary was called.
298
+ # Corresponds to the JSON property `submitTime`
299
+ # @return [String]
300
+ attr_accessor :submit_time
301
+
302
+ def initialize(**args)
303
+ update!(**args)
304
+ end
305
+
306
+ # Update properties of this object
307
+ def update!(**args)
308
+ @end_time = args[:end_time] if args.key?(:end_time)
309
+ @entry_count = args[:entry_count] if args.key?(:entry_count)
310
+ @input_config = args[:input_config] if args.key?(:input_config)
311
+ @language_codes_set = args[:language_codes_set] if args.key?(:language_codes_set)
312
+ @language_pair = args[:language_pair] if args.key?(:language_pair)
313
+ @name = args[:name] if args.key?(:name)
314
+ @submit_time = args[:submit_time] if args.key?(:submit_time)
315
+ end
316
+ end
317
+
318
+ # Input configuration for glossaries.
319
+ class GlossaryInputConfig
320
+ include Google::Apis::Core::Hashable
321
+
322
+ # The Google Cloud Storage location for the input content.
323
+ # Corresponds to the JSON property `gcsSource`
324
+ # @return [Google::Apis::TranslateV3::GcsSource]
325
+ attr_accessor :gcs_source
326
+
327
+ def initialize(**args)
328
+ update!(**args)
329
+ end
330
+
331
+ # Update properties of this object
332
+ def update!(**args)
333
+ @gcs_source = args[:gcs_source] if args.key?(:gcs_source)
334
+ end
335
+ end
336
+
337
+ # Input configuration for BatchTranslateText request.
338
+ class InputConfig
339
+ include Google::Apis::Core::Hashable
340
+
341
+ # The Google Cloud Storage location for the input content.
342
+ # Corresponds to the JSON property `gcsSource`
343
+ # @return [Google::Apis::TranslateV3::GcsSource]
344
+ attr_accessor :gcs_source
345
+
346
+ # Optional. Can be "text/plain" or "text/html". For `.tsv`, "text/html" is used
347
+ # if mime_type is missing. For `.html`, this field must be "text/html" or empty.
348
+ # For `.txt`, this field must be "text/plain" or empty.
349
+ # Corresponds to the JSON property `mimeType`
350
+ # @return [String]
351
+ attr_accessor :mime_type
352
+
353
+ def initialize(**args)
354
+ update!(**args)
355
+ end
356
+
357
+ # Update properties of this object
358
+ def update!(**args)
359
+ @gcs_source = args[:gcs_source] if args.key?(:gcs_source)
360
+ @mime_type = args[:mime_type] if args.key?(:mime_type)
361
+ end
362
+ end
363
+
364
+ # Used with unidirectional glossaries.
365
+ class LanguageCodePair
366
+ include Google::Apis::Core::Hashable
367
+
368
+ # Required. The BCP-47 language code of the input text, for example, "en-US".
369
+ # Expected to be an exact match for GlossaryTerm.language_code.
370
+ # Corresponds to the JSON property `sourceLanguageCode`
371
+ # @return [String]
372
+ attr_accessor :source_language_code
373
+
374
+ # Required. The BCP-47 language code for translation output, for example, "zh-CN"
375
+ # . Expected to be an exact match for GlossaryTerm.language_code.
376
+ # Corresponds to the JSON property `targetLanguageCode`
377
+ # @return [String]
378
+ attr_accessor :target_language_code
379
+
380
+ def initialize(**args)
381
+ update!(**args)
382
+ end
383
+
384
+ # Update properties of this object
385
+ def update!(**args)
386
+ @source_language_code = args[:source_language_code] if args.key?(:source_language_code)
387
+ @target_language_code = args[:target_language_code] if args.key?(:target_language_code)
388
+ end
389
+ end
390
+
391
+ # Used with equivalent term set glossaries.
392
+ class LanguageCodesSet
393
+ include Google::Apis::Core::Hashable
394
+
395
+ # The BCP-47 language code(s) for terms defined in the glossary. All entries are
396
+ # unique. The list contains at least two entries. Expected to be an exact match
397
+ # for GlossaryTerm.language_code.
398
+ # Corresponds to the JSON property `languageCodes`
399
+ # @return [Array<String>]
400
+ attr_accessor :language_codes
401
+
402
+ def initialize(**args)
403
+ update!(**args)
404
+ end
405
+
406
+ # Update properties of this object
407
+ def update!(**args)
408
+ @language_codes = args[:language_codes] if args.key?(:language_codes)
409
+ end
410
+ end
411
+
412
+ # Response message for ListGlossaries.
413
+ class ListGlossariesResponse
414
+ include Google::Apis::Core::Hashable
415
+
416
+ # The list of glossaries for a project.
417
+ # Corresponds to the JSON property `glossaries`
418
+ # @return [Array<Google::Apis::TranslateV3::Glossary>]
419
+ attr_accessor :glossaries
420
+
421
+ # A token to retrieve a page of results. Pass this value in the [
422
+ # ListGlossariesRequest.page_token] field in the subsequent call to `
423
+ # ListGlossaries` method to retrieve the next page of results.
424
+ # Corresponds to the JSON property `nextPageToken`
425
+ # @return [String]
426
+ attr_accessor :next_page_token
427
+
428
+ def initialize(**args)
429
+ update!(**args)
430
+ end
431
+
432
+ # Update properties of this object
433
+ def update!(**args)
434
+ @glossaries = args[:glossaries] if args.key?(:glossaries)
435
+ @next_page_token = args[:next_page_token] if args.key?(:next_page_token)
436
+ end
437
+ end
438
+
439
+ # The response message for Locations.ListLocations.
440
+ class ListLocationsResponse
441
+ include Google::Apis::Core::Hashable
442
+
443
+ # A list of locations that matches the specified filter in the request.
444
+ # Corresponds to the JSON property `locations`
445
+ # @return [Array<Google::Apis::TranslateV3::Location>]
446
+ attr_accessor :locations
447
+
448
+ # The standard List next-page token.
449
+ # Corresponds to the JSON property `nextPageToken`
450
+ # @return [String]
451
+ attr_accessor :next_page_token
452
+
453
+ def initialize(**args)
454
+ update!(**args)
455
+ end
456
+
457
+ # Update properties of this object
458
+ def update!(**args)
459
+ @locations = args[:locations] if args.key?(:locations)
460
+ @next_page_token = args[:next_page_token] if args.key?(:next_page_token)
461
+ end
462
+ end
463
+
464
+ # The response message for Operations.ListOperations.
465
+ class ListOperationsResponse
466
+ include Google::Apis::Core::Hashable
467
+
468
+ # The standard List next-page token.
469
+ # Corresponds to the JSON property `nextPageToken`
470
+ # @return [String]
471
+ attr_accessor :next_page_token
472
+
473
+ # A list of operations that matches the specified filter in the request.
474
+ # Corresponds to the JSON property `operations`
475
+ # @return [Array<Google::Apis::TranslateV3::Operation>]
476
+ attr_accessor :operations
477
+
478
+ def initialize(**args)
479
+ update!(**args)
480
+ end
481
+
482
+ # Update properties of this object
483
+ def update!(**args)
484
+ @next_page_token = args[:next_page_token] if args.key?(:next_page_token)
485
+ @operations = args[:operations] if args.key?(:operations)
486
+ end
487
+ end
488
+
489
+ # A resource that represents Google Cloud Platform location.
490
+ class Location
491
+ include Google::Apis::Core::Hashable
492
+
493
+ # The friendly name for this location, typically a nearby city name. For example,
494
+ # "Tokyo".
495
+ # Corresponds to the JSON property `displayName`
496
+ # @return [String]
497
+ attr_accessor :display_name
498
+
499
+ # Cross-service attributes for the location. For example `"cloud.googleapis.com/
500
+ # region": "us-east1"`
501
+ # Corresponds to the JSON property `labels`
502
+ # @return [Hash<String,String>]
503
+ attr_accessor :labels
504
+
505
+ # The canonical id for this location. For example: `"us-east1"`.
506
+ # Corresponds to the JSON property `locationId`
507
+ # @return [String]
508
+ attr_accessor :location_id
509
+
510
+ # Service-specific metadata. For example the available capacity at the given
511
+ # location.
512
+ # Corresponds to the JSON property `metadata`
513
+ # @return [Hash<String,Object>]
514
+ attr_accessor :metadata
515
+
516
+ # Resource name for the location, which may vary between implementations. For
517
+ # example: `"projects/example-project/locations/us-east1"`
518
+ # Corresponds to the JSON property `name`
519
+ # @return [String]
520
+ attr_accessor :name
521
+
522
+ def initialize(**args)
523
+ update!(**args)
524
+ end
525
+
526
+ # Update properties of this object
527
+ def update!(**args)
528
+ @display_name = args[:display_name] if args.key?(:display_name)
529
+ @labels = args[:labels] if args.key?(:labels)
530
+ @location_id = args[:location_id] if args.key?(:location_id)
531
+ @metadata = args[:metadata] if args.key?(:metadata)
532
+ @name = args[:name] if args.key?(:name)
533
+ end
534
+ end
535
+
536
+ # This resource represents a long-running operation that is the result of a
537
+ # network API call.
538
+ class Operation
539
+ include Google::Apis::Core::Hashable
540
+
541
+ # If the value is `false`, it means the operation is still in progress. If `true`
542
+ # , the operation is completed, and either `error` or `response` is available.
543
+ # Corresponds to the JSON property `done`
544
+ # @return [Boolean]
545
+ attr_accessor :done
546
+ alias_method :done?, :done
547
+
548
+ # The `Status` type defines a logical error model that is suitable for different
549
+ # programming environments, including REST APIs and RPC APIs. It is used by [
550
+ # gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
551
+ # data: error code, error message, and error details. You can find out more
552
+ # about this error model and how to work with it in the [API Design Guide](https:
553
+ # //cloud.google.com/apis/design/errors).
554
+ # Corresponds to the JSON property `error`
555
+ # @return [Google::Apis::TranslateV3::Status]
556
+ attr_accessor :error
557
+
558
+ # Service-specific metadata associated with the operation. It typically contains
559
+ # progress information and common metadata such as create time. Some services
560
+ # might not provide such metadata. Any method that returns a long-running
561
+ # operation should document the metadata type, if any.
562
+ # Corresponds to the JSON property `metadata`
563
+ # @return [Hash<String,Object>]
564
+ attr_accessor :metadata
565
+
566
+ # The server-assigned name, which is only unique within the same service that
567
+ # originally returns it. If you use the default HTTP mapping, the `name` should
568
+ # be a resource name ending with `operations/`unique_id``.
569
+ # Corresponds to the JSON property `name`
570
+ # @return [String]
571
+ attr_accessor :name
572
+
573
+ # The normal response of the operation in case of success. If the original
574
+ # method returns no data on success, such as `Delete`, the response is `google.
575
+ # protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`,
576
+ # the response should be the resource. For other methods, the response should
577
+ # have the type `XxxResponse`, where `Xxx` is the original method name. For
578
+ # example, if the original method name is `TakeSnapshot()`, the inferred
579
+ # response type is `TakeSnapshotResponse`.
580
+ # Corresponds to the JSON property `response`
581
+ # @return [Hash<String,Object>]
582
+ attr_accessor :response
583
+
584
+ def initialize(**args)
585
+ update!(**args)
586
+ end
587
+
588
+ # Update properties of this object
589
+ def update!(**args)
590
+ @done = args[:done] if args.key?(:done)
591
+ @error = args[:error] if args.key?(:error)
592
+ @metadata = args[:metadata] if args.key?(:metadata)
593
+ @name = args[:name] if args.key?(:name)
594
+ @response = args[:response] if args.key?(:response)
595
+ end
596
+ end
597
+
598
+ # Output configuration for BatchTranslateText request.
599
+ class OutputConfig
600
+ include Google::Apis::Core::Hashable
601
+
602
+ # The Google Cloud Storage location for the output content.
603
+ # Corresponds to the JSON property `gcsDestination`
604
+ # @return [Google::Apis::TranslateV3::GcsDestination]
605
+ attr_accessor :gcs_destination
606
+
607
+ def initialize(**args)
608
+ update!(**args)
609
+ end
610
+
611
+ # Update properties of this object
612
+ def update!(**args)
613
+ @gcs_destination = args[:gcs_destination] if args.key?(:gcs_destination)
614
+ end
615
+ end
616
+
617
+ # The `Status` type defines a logical error model that is suitable for different
618
+ # programming environments, including REST APIs and RPC APIs. It is used by [
619
+ # gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
620
+ # data: error code, error message, and error details. You can find out more
621
+ # about this error model and how to work with it in the [API Design Guide](https:
622
+ # //cloud.google.com/apis/design/errors).
623
+ class Status
624
+ include Google::Apis::Core::Hashable
625
+
626
+ # The status code, which should be an enum value of google.rpc.Code.
627
+ # Corresponds to the JSON property `code`
628
+ # @return [Fixnum]
629
+ attr_accessor :code
630
+
631
+ # A list of messages that carry the error details. There is a common set of
632
+ # message types for APIs to use.
633
+ # Corresponds to the JSON property `details`
634
+ # @return [Array<Hash<String,Object>>]
635
+ attr_accessor :details
636
+
637
+ # A developer-facing error message, which should be in English. Any user-facing
638
+ # error message should be localized and sent in the google.rpc.Status.details
639
+ # field, or localized by the client.
640
+ # Corresponds to the JSON property `message`
641
+ # @return [String]
642
+ attr_accessor :message
643
+
644
+ def initialize(**args)
645
+ update!(**args)
646
+ end
647
+
648
+ # Update properties of this object
649
+ def update!(**args)
650
+ @code = args[:code] if args.key?(:code)
651
+ @details = args[:details] if args.key?(:details)
652
+ @message = args[:message] if args.key?(:message)
653
+ end
654
+ end
655
+
656
+ # A single supported language response corresponds to information related to one
657
+ # supported language.
658
+ class SupportedLanguage
659
+ include Google::Apis::Core::Hashable
660
+
661
+ # Human readable name of the language localized in the display language
662
+ # specified in the request.
663
+ # Corresponds to the JSON property `displayName`
664
+ # @return [String]
665
+ attr_accessor :display_name
666
+
667
+ # Supported language code, generally consisting of its ISO 639-1 identifier, for
668
+ # example, 'en', 'ja'. In certain cases, BCP-47 codes including language and
669
+ # region identifiers are returned (for example, 'zh-TW' and 'zh-CN')
670
+ # Corresponds to the JSON property `languageCode`
671
+ # @return [String]
672
+ attr_accessor :language_code
673
+
674
+ # Can be used as source language.
675
+ # Corresponds to the JSON property `supportSource`
676
+ # @return [Boolean]
677
+ attr_accessor :support_source
678
+ alias_method :support_source?, :support_source
679
+
680
+ # Can be used as target language.
681
+ # Corresponds to the JSON property `supportTarget`
682
+ # @return [Boolean]
683
+ attr_accessor :support_target
684
+ alias_method :support_target?, :support_target
685
+
686
+ def initialize(**args)
687
+ update!(**args)
688
+ end
689
+
690
+ # Update properties of this object
691
+ def update!(**args)
692
+ @display_name = args[:display_name] if args.key?(:display_name)
693
+ @language_code = args[:language_code] if args.key?(:language_code)
694
+ @support_source = args[:support_source] if args.key?(:support_source)
695
+ @support_target = args[:support_target] if args.key?(:support_target)
696
+ end
697
+ end
698
+
699
+ # The response message for discovering supported languages.
700
+ class SupportedLanguages
701
+ include Google::Apis::Core::Hashable
702
+
703
+ # A list of supported language responses. This list contains an entry for each
704
+ # language the Translation API supports.
705
+ # Corresponds to the JSON property `languages`
706
+ # @return [Array<Google::Apis::TranslateV3::SupportedLanguage>]
707
+ attr_accessor :languages
708
+
709
+ def initialize(**args)
710
+ update!(**args)
711
+ end
712
+
713
+ # Update properties of this object
714
+ def update!(**args)
715
+ @languages = args[:languages] if args.key?(:languages)
716
+ end
717
+ end
718
+
719
+ # Configures which glossary should be used for a specific target language, and
720
+ # defines options for applying that glossary.
721
+ class TranslateTextGlossaryConfig
722
+ include Google::Apis::Core::Hashable
723
+
724
+ # Required. The `glossary` to be applied for this translation. The format
725
+ # depends on glossary: - User provided custom glossary: `projects/`project-
726
+ # number-or-id`/locations/`location-id`/glossaries/`glossary-id``
727
+ # Corresponds to the JSON property `glossary`
728
+ # @return [String]
729
+ attr_accessor :glossary
730
+
731
+ # Optional. Indicates match is case-insensitive. Default value is false if
732
+ # missing.
733
+ # Corresponds to the JSON property `ignoreCase`
734
+ # @return [Boolean]
735
+ attr_accessor :ignore_case
736
+ alias_method :ignore_case?, :ignore_case
737
+
738
+ def initialize(**args)
739
+ update!(**args)
740
+ end
741
+
742
+ # Update properties of this object
743
+ def update!(**args)
744
+ @glossary = args[:glossary] if args.key?(:glossary)
745
+ @ignore_case = args[:ignore_case] if args.key?(:ignore_case)
746
+ end
747
+ end
748
+
749
+ # The request message for synchronous translation.
750
+ class TranslateTextRequest
751
+ include Google::Apis::Core::Hashable
752
+
753
+ # Required. The content of the input in string format. We recommend the total
754
+ # content be less than 30k codepoints. The max length of this field is 1024. Use
755
+ # BatchTranslateText for larger text.
756
+ # Corresponds to the JSON property `contents`
757
+ # @return [Array<String>]
758
+ attr_accessor :contents
759
+
760
+ # Configures which glossary should be used for a specific target language, and
761
+ # defines options for applying that glossary.
762
+ # Corresponds to the JSON property `glossaryConfig`
763
+ # @return [Google::Apis::TranslateV3::TranslateTextGlossaryConfig]
764
+ attr_accessor :glossary_config
765
+
766
+ # Optional. The labels with user-defined metadata for the request. Label keys
767
+ # and values can be no longer than 63 characters (Unicode codepoints), can only
768
+ # contain lowercase letters, numeric characters, underscores and dashes.
769
+ # International characters are allowed. Label values are optional. Label keys
770
+ # must start with a letter. See https://cloud.google.com/translate/docs/advanced/
771
+ # labels for more information.
772
+ # Corresponds to the JSON property `labels`
773
+ # @return [Hash<String,String>]
774
+ attr_accessor :labels
775
+
776
+ # Optional. The format of the source text, for example, "text/html", "text/plain"
777
+ # . If left blank, the MIME type defaults to "text/html".
778
+ # Corresponds to the JSON property `mimeType`
779
+ # @return [String]
780
+ attr_accessor :mime_type
781
+
782
+ # Optional. The `model` type requested for this translation. The format depends
783
+ # on model type: - AutoML Translation models: `projects/`project-number-or-id`/
784
+ # locations/`location-id`/models/`model-id`` - General (built-in) models: `
785
+ # projects/`project-number-or-id`/locations/`location-id`/models/general/nmt`, `
786
+ # projects/`project-number-or-id`/locations/`location-id`/models/general/base`
787
+ # For global (non-regionalized) requests, use `location-id` `global`. For
788
+ # example, `projects/`project-number-or-id`/locations/global/models/general/nmt`.
789
+ # If missing, the system decides which google base model to use.
790
+ # Corresponds to the JSON property `model`
791
+ # @return [String]
792
+ attr_accessor :model
793
+
794
+ # Optional. The BCP-47 language code of the input text if known, for example, "
795
+ # en-US" or "sr-Latn". Supported language codes are listed in Language Support.
796
+ # If the source language isn't specified, the API attempts to identify the
797
+ # source language automatically and returns the source language within the
798
+ # response.
799
+ # Corresponds to the JSON property `sourceLanguageCode`
800
+ # @return [String]
801
+ attr_accessor :source_language_code
802
+
803
+ # Required. The BCP-47 language code to use for translation of the input text,
804
+ # set to one of the language codes listed in Language Support.
805
+ # Corresponds to the JSON property `targetLanguageCode`
806
+ # @return [String]
807
+ attr_accessor :target_language_code
808
+
809
+ def initialize(**args)
810
+ update!(**args)
811
+ end
812
+
813
+ # Update properties of this object
814
+ def update!(**args)
815
+ @contents = args[:contents] if args.key?(:contents)
816
+ @glossary_config = args[:glossary_config] if args.key?(:glossary_config)
817
+ @labels = args[:labels] if args.key?(:labels)
818
+ @mime_type = args[:mime_type] if args.key?(:mime_type)
819
+ @model = args[:model] if args.key?(:model)
820
+ @source_language_code = args[:source_language_code] if args.key?(:source_language_code)
821
+ @target_language_code = args[:target_language_code] if args.key?(:target_language_code)
822
+ end
823
+ end
824
+
825
+ #
826
+ class TranslateTextResponse
827
+ include Google::Apis::Core::Hashable
828
+
829
+ # Text translation responses if a glossary is provided in the request. This can
830
+ # be the same as `translations` if no terms apply. This field has the same
831
+ # length as `contents`.
832
+ # Corresponds to the JSON property `glossaryTranslations`
833
+ # @return [Array<Google::Apis::TranslateV3::Translation>]
834
+ attr_accessor :glossary_translations
835
+
836
+ # Text translation responses with no glossary applied. This field has the same
837
+ # length as `contents`.
838
+ # Corresponds to the JSON property `translations`
839
+ # @return [Array<Google::Apis::TranslateV3::Translation>]
840
+ attr_accessor :translations
841
+
842
+ def initialize(**args)
843
+ update!(**args)
844
+ end
845
+
846
+ # Update properties of this object
847
+ def update!(**args)
848
+ @glossary_translations = args[:glossary_translations] if args.key?(:glossary_translations)
849
+ @translations = args[:translations] if args.key?(:translations)
850
+ end
851
+ end
852
+
853
+ # A single translation response.
854
+ class Translation
855
+ include Google::Apis::Core::Hashable
856
+
857
+ # The BCP-47 language code of source text in the initial request, detected
858
+ # automatically, if no source language was passed within the initial request. If
859
+ # the source language was passed, auto-detection of the language does not occur
860
+ # and this field is empty.
861
+ # Corresponds to the JSON property `detectedLanguageCode`
862
+ # @return [String]
863
+ attr_accessor :detected_language_code
864
+
865
+ # Configures which glossary should be used for a specific target language, and
866
+ # defines options for applying that glossary.
867
+ # Corresponds to the JSON property `glossaryConfig`
868
+ # @return [Google::Apis::TranslateV3::TranslateTextGlossaryConfig]
869
+ attr_accessor :glossary_config
870
+
871
+ # Only present when `model` is present in the request. `model` here is
872
+ # normalized to have project number. For example: If the `model` requested in
873
+ # TranslationTextRequest is `projects/`project-id`/locations/`location-id`/
874
+ # models/general/nmt` then `model` here would be normalized to `projects/`
875
+ # project-number`/locations/`location-id`/models/general/nmt`.
876
+ # Corresponds to the JSON property `model`
877
+ # @return [String]
878
+ attr_accessor :model
879
+
880
+ # Text translated into the target language.
881
+ # Corresponds to the JSON property `translatedText`
882
+ # @return [String]
883
+ attr_accessor :translated_text
884
+
885
+ def initialize(**args)
886
+ update!(**args)
887
+ end
888
+
889
+ # Update properties of this object
890
+ def update!(**args)
891
+ @detected_language_code = args[:detected_language_code] if args.key?(:detected_language_code)
892
+ @glossary_config = args[:glossary_config] if args.key?(:glossary_config)
893
+ @model = args[:model] if args.key?(:model)
894
+ @translated_text = args[:translated_text] if args.key?(:translated_text)
895
+ end
896
+ end
897
+
898
+ # The request message for Operations.WaitOperation.
899
+ class WaitOperationRequest
900
+ include Google::Apis::Core::Hashable
901
+
902
+ # The maximum duration to wait before timing out. If left blank, the wait will
903
+ # be at most the time permitted by the underlying HTTP/RPC protocol. If RPC
904
+ # context deadline is also specified, the shorter one will be used.
905
+ # Corresponds to the JSON property `timeout`
906
+ # @return [String]
907
+ attr_accessor :timeout
908
+
909
+ def initialize(**args)
910
+ update!(**args)
911
+ end
912
+
913
+ # Update properties of this object
914
+ def update!(**args)
915
+ @timeout = args[:timeout] if args.key?(:timeout)
916
+ end
917
+ end
918
+ end
919
+ end
920
+ end