google-apis-translate_v3beta1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-translate_v3beta1.rb +15 -0
- data/lib/google/apis/translate_v3beta1.rb +39 -0
- data/lib/google/apis/translate_v3beta1/classes.rb +917 -0
- data/lib/google/apis/translate_v3beta1/gem_version.rb +28 -0
- data/lib/google/apis/translate_v3beta1/representations.rb +439 -0
- data/lib/google/apis/translate_v3beta1/service.rb +767 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 43142ec2259c745675d9e7aa543b43c4c63883455629df12069d67325f7625d0
|
4
|
+
data.tar.gz: 6e0feaf5c18a7b2ebbc0f65ddba6d9b75d055aa68ba1c5f4421cd4bdba642833
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 881ba944c1cf86c8f03ce1d5a5c5b8c210afa2cc8bef1b0d70a2fcb6a41bbbe9bf471c67c6e93fdb9963add5e820b1b74bf0b5b86e9902cedd2f542f77413c7c
|
7
|
+
data.tar.gz: 8c6cbaa8b429370401a567ba09d1efb86a61b89177fe76a079964284d46bd2c9b3d1783214da02146af50a2fc4b406aef5bd0546cc18e1688f39cd63aaab52a4
|
data/.yardopts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
--hide-void-return
|
2
|
+
--no-private
|
3
|
+
--verbose
|
4
|
+
--title=google-apis-translate_v3beta1
|
5
|
+
--markup-provider=redcarpet
|
6
|
+
--markup=markdown
|
7
|
+
--main OVERVIEW.md
|
8
|
+
lib/google/apis/translate_v3beta1/*.rb
|
9
|
+
lib/google/apis/translate_v3beta1.rb
|
10
|
+
-
|
11
|
+
OVERVIEW.md
|
12
|
+
CHANGELOG.md
|
13
|
+
LICENSE.md
|
data/CHANGELOG.md
ADDED
data/LICENSE.md
ADDED
@@ -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.
|
data/OVERVIEW.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Simple REST client for version V3beta1 of the Cloud Translation API
|
2
|
+
|
3
|
+
This is a simple client library for version V3beta1 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_v3beta1', '~> 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_v3beta1
|
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_v3beta1"
|
49
|
+
|
50
|
+
# Create a client object
|
51
|
+
client = Google::Apis::TranslateV3beta1::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::TranslateV3beta1::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_v3beta1`, 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_v3beta1"
|
@@ -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_v3beta1/service.rb'
|
16
|
+
require 'google/apis/translate_v3beta1/classes.rb'
|
17
|
+
require 'google/apis/translate_v3beta1/representations.rb'
|
18
|
+
require 'google/apis/translate_v3beta1/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 TranslateV3beta1
|
28
|
+
# Version of the Cloud Translation API this client connects to.
|
29
|
+
# This is NOT the gem version.
|
30
|
+
VERSION = 'V3beta1'
|
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,917 @@
|
|
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 TranslateV3beta1
|
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::TranslateV3beta1::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::TranslateV3beta1::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/labels
|
47
|
+
# 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::TranslateV3beta1::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/labels
|
123
|
+
# 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
|
+
# A list of detected languages sorted by detection confidence in descending
|
161
|
+
# order. The most probable language first.
|
162
|
+
# Corresponds to the JSON property `languages`
|
163
|
+
# @return [Array<Google::Apis::TranslateV3beta1::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. There must be no files under 'output_uri_prefix'. 'output_uri_prefix'
|
224
|
+
# must end with "/" and start with "gs://", otherwise an INVALID_ARGUMENT (400)
|
225
|
+
# error is returned.
|
226
|
+
# Corresponds to the JSON property `outputUriPrefix`
|
227
|
+
# @return [String]
|
228
|
+
attr_accessor :output_uri_prefix
|
229
|
+
|
230
|
+
def initialize(**args)
|
231
|
+
update!(**args)
|
232
|
+
end
|
233
|
+
|
234
|
+
# Update properties of this object
|
235
|
+
def update!(**args)
|
236
|
+
@output_uri_prefix = args[:output_uri_prefix] if args.key?(:output_uri_prefix)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
# The Google Cloud Storage location for the input content.
|
241
|
+
class GcsSource
|
242
|
+
include Google::Apis::Core::Hashable
|
243
|
+
|
244
|
+
# Required. Source data URI. For example, `gs://my_bucket/my_object`.
|
245
|
+
# Corresponds to the JSON property `inputUri`
|
246
|
+
# @return [String]
|
247
|
+
attr_accessor :input_uri
|
248
|
+
|
249
|
+
def initialize(**args)
|
250
|
+
update!(**args)
|
251
|
+
end
|
252
|
+
|
253
|
+
# Update properties of this object
|
254
|
+
def update!(**args)
|
255
|
+
@input_uri = args[:input_uri] if args.key?(:input_uri)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Represents a glossary built from user provided data.
|
260
|
+
class Glossary
|
261
|
+
include Google::Apis::Core::Hashable
|
262
|
+
|
263
|
+
# Output only. When the glossary creation was finished.
|
264
|
+
# Corresponds to the JSON property `endTime`
|
265
|
+
# @return [String]
|
266
|
+
attr_accessor :end_time
|
267
|
+
|
268
|
+
# Output only. The number of entries defined in the glossary.
|
269
|
+
# Corresponds to the JSON property `entryCount`
|
270
|
+
# @return [Fixnum]
|
271
|
+
attr_accessor :entry_count
|
272
|
+
|
273
|
+
# Input configuration for glossaries.
|
274
|
+
# Corresponds to the JSON property `inputConfig`
|
275
|
+
# @return [Google::Apis::TranslateV3beta1::GlossaryInputConfig]
|
276
|
+
attr_accessor :input_config
|
277
|
+
|
278
|
+
# Used with equivalent term set glossaries.
|
279
|
+
# Corresponds to the JSON property `languageCodesSet`
|
280
|
+
# @return [Google::Apis::TranslateV3beta1::LanguageCodesSet]
|
281
|
+
attr_accessor :language_codes_set
|
282
|
+
|
283
|
+
# Used with unidirectional glossaries.
|
284
|
+
# Corresponds to the JSON property `languagePair`
|
285
|
+
# @return [Google::Apis::TranslateV3beta1::LanguageCodePair]
|
286
|
+
attr_accessor :language_pair
|
287
|
+
|
288
|
+
# Required. The resource name of the glossary. Glossary names have the form `
|
289
|
+
# projects/`project-number-or-id`/locations/`location-id`/glossaries/`glossary-
|
290
|
+
# id``.
|
291
|
+
# Corresponds to the JSON property `name`
|
292
|
+
# @return [String]
|
293
|
+
attr_accessor :name
|
294
|
+
|
295
|
+
# Output only. When CreateGlossary was called.
|
296
|
+
# Corresponds to the JSON property `submitTime`
|
297
|
+
# @return [String]
|
298
|
+
attr_accessor :submit_time
|
299
|
+
|
300
|
+
def initialize(**args)
|
301
|
+
update!(**args)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Update properties of this object
|
305
|
+
def update!(**args)
|
306
|
+
@end_time = args[:end_time] if args.key?(:end_time)
|
307
|
+
@entry_count = args[:entry_count] if args.key?(:entry_count)
|
308
|
+
@input_config = args[:input_config] if args.key?(:input_config)
|
309
|
+
@language_codes_set = args[:language_codes_set] if args.key?(:language_codes_set)
|
310
|
+
@language_pair = args[:language_pair] if args.key?(:language_pair)
|
311
|
+
@name = args[:name] if args.key?(:name)
|
312
|
+
@submit_time = args[:submit_time] if args.key?(:submit_time)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# Input configuration for glossaries.
|
317
|
+
class GlossaryInputConfig
|
318
|
+
include Google::Apis::Core::Hashable
|
319
|
+
|
320
|
+
# The Google Cloud Storage location for the input content.
|
321
|
+
# Corresponds to the JSON property `gcsSource`
|
322
|
+
# @return [Google::Apis::TranslateV3beta1::GcsSource]
|
323
|
+
attr_accessor :gcs_source
|
324
|
+
|
325
|
+
def initialize(**args)
|
326
|
+
update!(**args)
|
327
|
+
end
|
328
|
+
|
329
|
+
# Update properties of this object
|
330
|
+
def update!(**args)
|
331
|
+
@gcs_source = args[:gcs_source] if args.key?(:gcs_source)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
# Input configuration for BatchTranslateText request.
|
336
|
+
class InputConfig
|
337
|
+
include Google::Apis::Core::Hashable
|
338
|
+
|
339
|
+
# The Google Cloud Storage location for the input content.
|
340
|
+
# Corresponds to the JSON property `gcsSource`
|
341
|
+
# @return [Google::Apis::TranslateV3beta1::GcsSource]
|
342
|
+
attr_accessor :gcs_source
|
343
|
+
|
344
|
+
# Optional. Can be "text/plain" or "text/html". For `.tsv`, "text/html" is used
|
345
|
+
# if mime_type is missing. For `.html`, this field must be "text/html" or empty.
|
346
|
+
# For `.txt`, this field must be "text/plain" or empty.
|
347
|
+
# Corresponds to the JSON property `mimeType`
|
348
|
+
# @return [String]
|
349
|
+
attr_accessor :mime_type
|
350
|
+
|
351
|
+
def initialize(**args)
|
352
|
+
update!(**args)
|
353
|
+
end
|
354
|
+
|
355
|
+
# Update properties of this object
|
356
|
+
def update!(**args)
|
357
|
+
@gcs_source = args[:gcs_source] if args.key?(:gcs_source)
|
358
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
# Used with unidirectional glossaries.
|
363
|
+
class LanguageCodePair
|
364
|
+
include Google::Apis::Core::Hashable
|
365
|
+
|
366
|
+
# Required. The BCP-47 language code of the input text, for example, "en-US".
|
367
|
+
# Expected to be an exact match for GlossaryTerm.language_code.
|
368
|
+
# Corresponds to the JSON property `sourceLanguageCode`
|
369
|
+
# @return [String]
|
370
|
+
attr_accessor :source_language_code
|
371
|
+
|
372
|
+
# Required. The BCP-47 language code for translation output, for example, "zh-CN"
|
373
|
+
# . Expected to be an exact match for GlossaryTerm.language_code.
|
374
|
+
# Corresponds to the JSON property `targetLanguageCode`
|
375
|
+
# @return [String]
|
376
|
+
attr_accessor :target_language_code
|
377
|
+
|
378
|
+
def initialize(**args)
|
379
|
+
update!(**args)
|
380
|
+
end
|
381
|
+
|
382
|
+
# Update properties of this object
|
383
|
+
def update!(**args)
|
384
|
+
@source_language_code = args[:source_language_code] if args.key?(:source_language_code)
|
385
|
+
@target_language_code = args[:target_language_code] if args.key?(:target_language_code)
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
# Used with equivalent term set glossaries.
|
390
|
+
class LanguageCodesSet
|
391
|
+
include Google::Apis::Core::Hashable
|
392
|
+
|
393
|
+
# The BCP-47 language code(s) for terms defined in the glossary. All entries are
|
394
|
+
# unique. The list contains at least two entries. Expected to be an exact match
|
395
|
+
# for GlossaryTerm.language_code.
|
396
|
+
# Corresponds to the JSON property `languageCodes`
|
397
|
+
# @return [Array<String>]
|
398
|
+
attr_accessor :language_codes
|
399
|
+
|
400
|
+
def initialize(**args)
|
401
|
+
update!(**args)
|
402
|
+
end
|
403
|
+
|
404
|
+
# Update properties of this object
|
405
|
+
def update!(**args)
|
406
|
+
@language_codes = args[:language_codes] if args.key?(:language_codes)
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
# Response message for ListGlossaries.
|
411
|
+
class ListGlossariesResponse
|
412
|
+
include Google::Apis::Core::Hashable
|
413
|
+
|
414
|
+
# The list of glossaries for a project.
|
415
|
+
# Corresponds to the JSON property `glossaries`
|
416
|
+
# @return [Array<Google::Apis::TranslateV3beta1::Glossary>]
|
417
|
+
attr_accessor :glossaries
|
418
|
+
|
419
|
+
# A token to retrieve a page of results. Pass this value in the [
|
420
|
+
# ListGlossariesRequest.page_token] field in the subsequent call to `
|
421
|
+
# ListGlossaries` method to retrieve the next page of results.
|
422
|
+
# Corresponds to the JSON property `nextPageToken`
|
423
|
+
# @return [String]
|
424
|
+
attr_accessor :next_page_token
|
425
|
+
|
426
|
+
def initialize(**args)
|
427
|
+
update!(**args)
|
428
|
+
end
|
429
|
+
|
430
|
+
# Update properties of this object
|
431
|
+
def update!(**args)
|
432
|
+
@glossaries = args[:glossaries] if args.key?(:glossaries)
|
433
|
+
@next_page_token = args[:next_page_token] if args.key?(:next_page_token)
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
# The response message for Locations.ListLocations.
|
438
|
+
class ListLocationsResponse
|
439
|
+
include Google::Apis::Core::Hashable
|
440
|
+
|
441
|
+
# A list of locations that matches the specified filter in the request.
|
442
|
+
# Corresponds to the JSON property `locations`
|
443
|
+
# @return [Array<Google::Apis::TranslateV3beta1::Location>]
|
444
|
+
attr_accessor :locations
|
445
|
+
|
446
|
+
# The standard List next-page token.
|
447
|
+
# Corresponds to the JSON property `nextPageToken`
|
448
|
+
# @return [String]
|
449
|
+
attr_accessor :next_page_token
|
450
|
+
|
451
|
+
def initialize(**args)
|
452
|
+
update!(**args)
|
453
|
+
end
|
454
|
+
|
455
|
+
# Update properties of this object
|
456
|
+
def update!(**args)
|
457
|
+
@locations = args[:locations] if args.key?(:locations)
|
458
|
+
@next_page_token = args[:next_page_token] if args.key?(:next_page_token)
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
# The response message for Operations.ListOperations.
|
463
|
+
class ListOperationsResponse
|
464
|
+
include Google::Apis::Core::Hashable
|
465
|
+
|
466
|
+
# The standard List next-page token.
|
467
|
+
# Corresponds to the JSON property `nextPageToken`
|
468
|
+
# @return [String]
|
469
|
+
attr_accessor :next_page_token
|
470
|
+
|
471
|
+
# A list of operations that matches the specified filter in the request.
|
472
|
+
# Corresponds to the JSON property `operations`
|
473
|
+
# @return [Array<Google::Apis::TranslateV3beta1::Operation>]
|
474
|
+
attr_accessor :operations
|
475
|
+
|
476
|
+
def initialize(**args)
|
477
|
+
update!(**args)
|
478
|
+
end
|
479
|
+
|
480
|
+
# Update properties of this object
|
481
|
+
def update!(**args)
|
482
|
+
@next_page_token = args[:next_page_token] if args.key?(:next_page_token)
|
483
|
+
@operations = args[:operations] if args.key?(:operations)
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
# A resource that represents Google Cloud Platform location.
|
488
|
+
class Location
|
489
|
+
include Google::Apis::Core::Hashable
|
490
|
+
|
491
|
+
# The friendly name for this location, typically a nearby city name. For example,
|
492
|
+
# "Tokyo".
|
493
|
+
# Corresponds to the JSON property `displayName`
|
494
|
+
# @return [String]
|
495
|
+
attr_accessor :display_name
|
496
|
+
|
497
|
+
# Cross-service attributes for the location. For example `"cloud.googleapis.com/
|
498
|
+
# region": "us-east1"`
|
499
|
+
# Corresponds to the JSON property `labels`
|
500
|
+
# @return [Hash<String,String>]
|
501
|
+
attr_accessor :labels
|
502
|
+
|
503
|
+
# The canonical id for this location. For example: `"us-east1"`.
|
504
|
+
# Corresponds to the JSON property `locationId`
|
505
|
+
# @return [String]
|
506
|
+
attr_accessor :location_id
|
507
|
+
|
508
|
+
# Service-specific metadata. For example the available capacity at the given
|
509
|
+
# location.
|
510
|
+
# Corresponds to the JSON property `metadata`
|
511
|
+
# @return [Hash<String,Object>]
|
512
|
+
attr_accessor :metadata
|
513
|
+
|
514
|
+
# Resource name for the location, which may vary between implementations. For
|
515
|
+
# example: `"projects/example-project/locations/us-east1"`
|
516
|
+
# Corresponds to the JSON property `name`
|
517
|
+
# @return [String]
|
518
|
+
attr_accessor :name
|
519
|
+
|
520
|
+
def initialize(**args)
|
521
|
+
update!(**args)
|
522
|
+
end
|
523
|
+
|
524
|
+
# Update properties of this object
|
525
|
+
def update!(**args)
|
526
|
+
@display_name = args[:display_name] if args.key?(:display_name)
|
527
|
+
@labels = args[:labels] if args.key?(:labels)
|
528
|
+
@location_id = args[:location_id] if args.key?(:location_id)
|
529
|
+
@metadata = args[:metadata] if args.key?(:metadata)
|
530
|
+
@name = args[:name] if args.key?(:name)
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
# This resource represents a long-running operation that is the result of a
|
535
|
+
# network API call.
|
536
|
+
class Operation
|
537
|
+
include Google::Apis::Core::Hashable
|
538
|
+
|
539
|
+
# If the value is `false`, it means the operation is still in progress. If `true`
|
540
|
+
# , the operation is completed, and either `error` or `response` is available.
|
541
|
+
# Corresponds to the JSON property `done`
|
542
|
+
# @return [Boolean]
|
543
|
+
attr_accessor :done
|
544
|
+
alias_method :done?, :done
|
545
|
+
|
546
|
+
# The `Status` type defines a logical error model that is suitable for different
|
547
|
+
# programming environments, including REST APIs and RPC APIs. It is used by [
|
548
|
+
# gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
|
549
|
+
# data: error code, error message, and error details. You can find out more
|
550
|
+
# about this error model and how to work with it in the [API Design Guide](https:
|
551
|
+
# //cloud.google.com/apis/design/errors).
|
552
|
+
# Corresponds to the JSON property `error`
|
553
|
+
# @return [Google::Apis::TranslateV3beta1::Status]
|
554
|
+
attr_accessor :error
|
555
|
+
|
556
|
+
# Service-specific metadata associated with the operation. It typically contains
|
557
|
+
# progress information and common metadata such as create time. Some services
|
558
|
+
# might not provide such metadata. Any method that returns a long-running
|
559
|
+
# operation should document the metadata type, if any.
|
560
|
+
# Corresponds to the JSON property `metadata`
|
561
|
+
# @return [Hash<String,Object>]
|
562
|
+
attr_accessor :metadata
|
563
|
+
|
564
|
+
# The server-assigned name, which is only unique within the same service that
|
565
|
+
# originally returns it. If you use the default HTTP mapping, the `name` should
|
566
|
+
# be a resource name ending with `operations/`unique_id``.
|
567
|
+
# Corresponds to the JSON property `name`
|
568
|
+
# @return [String]
|
569
|
+
attr_accessor :name
|
570
|
+
|
571
|
+
# The normal response of the operation in case of success. If the original
|
572
|
+
# method returns no data on success, such as `Delete`, the response is `google.
|
573
|
+
# protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`,
|
574
|
+
# the response should be the resource. For other methods, the response should
|
575
|
+
# have the type `XxxResponse`, where `Xxx` is the original method name. For
|
576
|
+
# example, if the original method name is `TakeSnapshot()`, the inferred
|
577
|
+
# response type is `TakeSnapshotResponse`.
|
578
|
+
# Corresponds to the JSON property `response`
|
579
|
+
# @return [Hash<String,Object>]
|
580
|
+
attr_accessor :response
|
581
|
+
|
582
|
+
def initialize(**args)
|
583
|
+
update!(**args)
|
584
|
+
end
|
585
|
+
|
586
|
+
# Update properties of this object
|
587
|
+
def update!(**args)
|
588
|
+
@done = args[:done] if args.key?(:done)
|
589
|
+
@error = args[:error] if args.key?(:error)
|
590
|
+
@metadata = args[:metadata] if args.key?(:metadata)
|
591
|
+
@name = args[:name] if args.key?(:name)
|
592
|
+
@response = args[:response] if args.key?(:response)
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
# Output configuration for BatchTranslateText request.
|
597
|
+
class OutputConfig
|
598
|
+
include Google::Apis::Core::Hashable
|
599
|
+
|
600
|
+
# The Google Cloud Storage location for the output content.
|
601
|
+
# Corresponds to the JSON property `gcsDestination`
|
602
|
+
# @return [Google::Apis::TranslateV3beta1::GcsDestination]
|
603
|
+
attr_accessor :gcs_destination
|
604
|
+
|
605
|
+
def initialize(**args)
|
606
|
+
update!(**args)
|
607
|
+
end
|
608
|
+
|
609
|
+
# Update properties of this object
|
610
|
+
def update!(**args)
|
611
|
+
@gcs_destination = args[:gcs_destination] if args.key?(:gcs_destination)
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
# The `Status` type defines a logical error model that is suitable for different
|
616
|
+
# programming environments, including REST APIs and RPC APIs. It is used by [
|
617
|
+
# gRPC](https://github.com/grpc). Each `Status` message contains three pieces of
|
618
|
+
# data: error code, error message, and error details. You can find out more
|
619
|
+
# about this error model and how to work with it in the [API Design Guide](https:
|
620
|
+
# //cloud.google.com/apis/design/errors).
|
621
|
+
class Status
|
622
|
+
include Google::Apis::Core::Hashable
|
623
|
+
|
624
|
+
# The status code, which should be an enum value of google.rpc.Code.
|
625
|
+
# Corresponds to the JSON property `code`
|
626
|
+
# @return [Fixnum]
|
627
|
+
attr_accessor :code
|
628
|
+
|
629
|
+
# A list of messages that carry the error details. There is a common set of
|
630
|
+
# message types for APIs to use.
|
631
|
+
# Corresponds to the JSON property `details`
|
632
|
+
# @return [Array<Hash<String,Object>>]
|
633
|
+
attr_accessor :details
|
634
|
+
|
635
|
+
# A developer-facing error message, which should be in English. Any user-facing
|
636
|
+
# error message should be localized and sent in the google.rpc.Status.details
|
637
|
+
# field, or localized by the client.
|
638
|
+
# Corresponds to the JSON property `message`
|
639
|
+
# @return [String]
|
640
|
+
attr_accessor :message
|
641
|
+
|
642
|
+
def initialize(**args)
|
643
|
+
update!(**args)
|
644
|
+
end
|
645
|
+
|
646
|
+
# Update properties of this object
|
647
|
+
def update!(**args)
|
648
|
+
@code = args[:code] if args.key?(:code)
|
649
|
+
@details = args[:details] if args.key?(:details)
|
650
|
+
@message = args[:message] if args.key?(:message)
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
# A single supported language response corresponds to information related to one
|
655
|
+
# supported language.
|
656
|
+
class SupportedLanguage
|
657
|
+
include Google::Apis::Core::Hashable
|
658
|
+
|
659
|
+
# Human readable name of the language localized in the display language
|
660
|
+
# specified in the request.
|
661
|
+
# Corresponds to the JSON property `displayName`
|
662
|
+
# @return [String]
|
663
|
+
attr_accessor :display_name
|
664
|
+
|
665
|
+
# Supported language code, generally consisting of its ISO 639-1 identifier, for
|
666
|
+
# example, 'en', 'ja'. In certain cases, BCP-47 codes including language and
|
667
|
+
# region identifiers are returned (for example, 'zh-TW' and 'zh-CN')
|
668
|
+
# Corresponds to the JSON property `languageCode`
|
669
|
+
# @return [String]
|
670
|
+
attr_accessor :language_code
|
671
|
+
|
672
|
+
# Can be used as source language.
|
673
|
+
# Corresponds to the JSON property `supportSource`
|
674
|
+
# @return [Boolean]
|
675
|
+
attr_accessor :support_source
|
676
|
+
alias_method :support_source?, :support_source
|
677
|
+
|
678
|
+
# Can be used as target language.
|
679
|
+
# Corresponds to the JSON property `supportTarget`
|
680
|
+
# @return [Boolean]
|
681
|
+
attr_accessor :support_target
|
682
|
+
alias_method :support_target?, :support_target
|
683
|
+
|
684
|
+
def initialize(**args)
|
685
|
+
update!(**args)
|
686
|
+
end
|
687
|
+
|
688
|
+
# Update properties of this object
|
689
|
+
def update!(**args)
|
690
|
+
@display_name = args[:display_name] if args.key?(:display_name)
|
691
|
+
@language_code = args[:language_code] if args.key?(:language_code)
|
692
|
+
@support_source = args[:support_source] if args.key?(:support_source)
|
693
|
+
@support_target = args[:support_target] if args.key?(:support_target)
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
# The response message for discovering supported languages.
|
698
|
+
class SupportedLanguages
|
699
|
+
include Google::Apis::Core::Hashable
|
700
|
+
|
701
|
+
# A list of supported language responses. This list contains an entry for each
|
702
|
+
# language the Translation API supports.
|
703
|
+
# Corresponds to the JSON property `languages`
|
704
|
+
# @return [Array<Google::Apis::TranslateV3beta1::SupportedLanguage>]
|
705
|
+
attr_accessor :languages
|
706
|
+
|
707
|
+
def initialize(**args)
|
708
|
+
update!(**args)
|
709
|
+
end
|
710
|
+
|
711
|
+
# Update properties of this object
|
712
|
+
def update!(**args)
|
713
|
+
@languages = args[:languages] if args.key?(:languages)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
# Configures which glossary should be used for a specific target language, and
|
718
|
+
# defines options for applying that glossary.
|
719
|
+
class TranslateTextGlossaryConfig
|
720
|
+
include Google::Apis::Core::Hashable
|
721
|
+
|
722
|
+
# Required. Specifies the glossary used for this translation. Use this format:
|
723
|
+
# projects/*/locations/*/glossaries/*
|
724
|
+
# Corresponds to the JSON property `glossary`
|
725
|
+
# @return [String]
|
726
|
+
attr_accessor :glossary
|
727
|
+
|
728
|
+
# Optional. Indicates match is case-insensitive. Default value is false if
|
729
|
+
# missing.
|
730
|
+
# Corresponds to the JSON property `ignoreCase`
|
731
|
+
# @return [Boolean]
|
732
|
+
attr_accessor :ignore_case
|
733
|
+
alias_method :ignore_case?, :ignore_case
|
734
|
+
|
735
|
+
def initialize(**args)
|
736
|
+
update!(**args)
|
737
|
+
end
|
738
|
+
|
739
|
+
# Update properties of this object
|
740
|
+
def update!(**args)
|
741
|
+
@glossary = args[:glossary] if args.key?(:glossary)
|
742
|
+
@ignore_case = args[:ignore_case] if args.key?(:ignore_case)
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
# The request message for synchronous translation.
|
747
|
+
class TranslateTextRequest
|
748
|
+
include Google::Apis::Core::Hashable
|
749
|
+
|
750
|
+
# Required. The content of the input in string format. We recommend the total
|
751
|
+
# content be less than 30k codepoints. The max length of this field is 1024. Use
|
752
|
+
# BatchTranslateText for larger text.
|
753
|
+
# Corresponds to the JSON property `contents`
|
754
|
+
# @return [Array<String>]
|
755
|
+
attr_accessor :contents
|
756
|
+
|
757
|
+
# Configures which glossary should be used for a specific target language, and
|
758
|
+
# defines options for applying that glossary.
|
759
|
+
# Corresponds to the JSON property `glossaryConfig`
|
760
|
+
# @return [Google::Apis::TranslateV3beta1::TranslateTextGlossaryConfig]
|
761
|
+
attr_accessor :glossary_config
|
762
|
+
|
763
|
+
# Optional. The labels with user-defined metadata for the request. Label keys
|
764
|
+
# and values can be no longer than 63 characters (Unicode codepoints), can only
|
765
|
+
# contain lowercase letters, numeric characters, underscores and dashes.
|
766
|
+
# International characters are allowed. Label values are optional. Label keys
|
767
|
+
# must start with a letter. See https://cloud.google.com/translate/docs/labels
|
768
|
+
# for more information.
|
769
|
+
# Corresponds to the JSON property `labels`
|
770
|
+
# @return [Hash<String,String>]
|
771
|
+
attr_accessor :labels
|
772
|
+
|
773
|
+
# Optional. The format of the source text, for example, "text/html", "text/plain"
|
774
|
+
# . If left blank, the MIME type defaults to "text/html".
|
775
|
+
# Corresponds to the JSON property `mimeType`
|
776
|
+
# @return [String]
|
777
|
+
attr_accessor :mime_type
|
778
|
+
|
779
|
+
# Optional. The `model` type requested for this translation. The format depends
|
780
|
+
# on model type: - AutoML Translation models: `projects/`project-number-or-id`/
|
781
|
+
# locations/`location-id`/models/`model-id`` - General (built-in) models: `
|
782
|
+
# projects/`project-number-or-id`/locations/`location-id`/models/general/nmt`, `
|
783
|
+
# projects/`project-number-or-id`/locations/`location-id`/models/general/base`
|
784
|
+
# For global (non-regionalized) requests, use `location-id` `global`. For
|
785
|
+
# example, `projects/`project-number-or-id`/locations/global/models/general/nmt`.
|
786
|
+
# If missing, the system decides which google base model to use.
|
787
|
+
# Corresponds to the JSON property `model`
|
788
|
+
# @return [String]
|
789
|
+
attr_accessor :model
|
790
|
+
|
791
|
+
# Optional. The BCP-47 language code of the input text if known, for example, "
|
792
|
+
# en-US" or "sr-Latn". Supported language codes are listed in Language Support.
|
793
|
+
# If the source language isn't specified, the API attempts to identify the
|
794
|
+
# source language automatically and returns the source language within the
|
795
|
+
# response.
|
796
|
+
# Corresponds to the JSON property `sourceLanguageCode`
|
797
|
+
# @return [String]
|
798
|
+
attr_accessor :source_language_code
|
799
|
+
|
800
|
+
# Required. The BCP-47 language code to use for translation of the input text,
|
801
|
+
# set to one of the language codes listed in Language Support.
|
802
|
+
# Corresponds to the JSON property `targetLanguageCode`
|
803
|
+
# @return [String]
|
804
|
+
attr_accessor :target_language_code
|
805
|
+
|
806
|
+
def initialize(**args)
|
807
|
+
update!(**args)
|
808
|
+
end
|
809
|
+
|
810
|
+
# Update properties of this object
|
811
|
+
def update!(**args)
|
812
|
+
@contents = args[:contents] if args.key?(:contents)
|
813
|
+
@glossary_config = args[:glossary_config] if args.key?(:glossary_config)
|
814
|
+
@labels = args[:labels] if args.key?(:labels)
|
815
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
816
|
+
@model = args[:model] if args.key?(:model)
|
817
|
+
@source_language_code = args[:source_language_code] if args.key?(:source_language_code)
|
818
|
+
@target_language_code = args[:target_language_code] if args.key?(:target_language_code)
|
819
|
+
end
|
820
|
+
end
|
821
|
+
|
822
|
+
#
|
823
|
+
class TranslateTextResponse
|
824
|
+
include Google::Apis::Core::Hashable
|
825
|
+
|
826
|
+
# Text translation responses if a glossary is provided in the request. This can
|
827
|
+
# be the same as `translations` if no terms apply. This field has the same
|
828
|
+
# length as `contents`.
|
829
|
+
# Corresponds to the JSON property `glossaryTranslations`
|
830
|
+
# @return [Array<Google::Apis::TranslateV3beta1::Translation>]
|
831
|
+
attr_accessor :glossary_translations
|
832
|
+
|
833
|
+
# Text translation responses with no glossary applied. This field has the same
|
834
|
+
# length as `contents`.
|
835
|
+
# Corresponds to the JSON property `translations`
|
836
|
+
# @return [Array<Google::Apis::TranslateV3beta1::Translation>]
|
837
|
+
attr_accessor :translations
|
838
|
+
|
839
|
+
def initialize(**args)
|
840
|
+
update!(**args)
|
841
|
+
end
|
842
|
+
|
843
|
+
# Update properties of this object
|
844
|
+
def update!(**args)
|
845
|
+
@glossary_translations = args[:glossary_translations] if args.key?(:glossary_translations)
|
846
|
+
@translations = args[:translations] if args.key?(:translations)
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
# A single translation response.
|
851
|
+
class Translation
|
852
|
+
include Google::Apis::Core::Hashable
|
853
|
+
|
854
|
+
# The BCP-47 language code of source text in the initial request, detected
|
855
|
+
# automatically, if no source language was passed within the initial request. If
|
856
|
+
# the source language was passed, auto-detection of the language does not occur
|
857
|
+
# and this field is empty.
|
858
|
+
# Corresponds to the JSON property `detectedLanguageCode`
|
859
|
+
# @return [String]
|
860
|
+
attr_accessor :detected_language_code
|
861
|
+
|
862
|
+
# Configures which glossary should be used for a specific target language, and
|
863
|
+
# defines options for applying that glossary.
|
864
|
+
# Corresponds to the JSON property `glossaryConfig`
|
865
|
+
# @return [Google::Apis::TranslateV3beta1::TranslateTextGlossaryConfig]
|
866
|
+
attr_accessor :glossary_config
|
867
|
+
|
868
|
+
# Only present when `model` is present in the request. `model` here is
|
869
|
+
# normalized to have project number. For example: If the `model` requested in
|
870
|
+
# TranslationTextRequest is `projects/`project-id`/locations/`location-id`/
|
871
|
+
# models/general/nmt` then `model` here would be normalized to `projects/`
|
872
|
+
# project-number`/locations/`location-id`/models/general/nmt`.
|
873
|
+
# Corresponds to the JSON property `model`
|
874
|
+
# @return [String]
|
875
|
+
attr_accessor :model
|
876
|
+
|
877
|
+
# Text translated into the target language.
|
878
|
+
# Corresponds to the JSON property `translatedText`
|
879
|
+
# @return [String]
|
880
|
+
attr_accessor :translated_text
|
881
|
+
|
882
|
+
def initialize(**args)
|
883
|
+
update!(**args)
|
884
|
+
end
|
885
|
+
|
886
|
+
# Update properties of this object
|
887
|
+
def update!(**args)
|
888
|
+
@detected_language_code = args[:detected_language_code] if args.key?(:detected_language_code)
|
889
|
+
@glossary_config = args[:glossary_config] if args.key?(:glossary_config)
|
890
|
+
@model = args[:model] if args.key?(:model)
|
891
|
+
@translated_text = args[:translated_text] if args.key?(:translated_text)
|
892
|
+
end
|
893
|
+
end
|
894
|
+
|
895
|
+
# The request message for Operations.WaitOperation.
|
896
|
+
class WaitOperationRequest
|
897
|
+
include Google::Apis::Core::Hashable
|
898
|
+
|
899
|
+
# The maximum duration to wait before timing out. If left blank, the wait will
|
900
|
+
# be at most the time permitted by the underlying HTTP/RPC protocol. If RPC
|
901
|
+
# context deadline is also specified, the shorter one will be used.
|
902
|
+
# Corresponds to the JSON property `timeout`
|
903
|
+
# @return [String]
|
904
|
+
attr_accessor :timeout
|
905
|
+
|
906
|
+
def initialize(**args)
|
907
|
+
update!(**args)
|
908
|
+
end
|
909
|
+
|
910
|
+
# Update properties of this object
|
911
|
+
def update!(**args)
|
912
|
+
@timeout = args[:timeout] if args.key?(:timeout)
|
913
|
+
end
|
914
|
+
end
|
915
|
+
end
|
916
|
+
end
|
917
|
+
end
|