google-cloud-language 0.36.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +3 -2
- data/AUTHENTICATION.md +62 -88
- data/LICENSE.md +201 -0
- data/MIGRATING.md +289 -0
- data/README.md +100 -31
- data/lib/google/cloud/language/version.rb +1 -1
- data/lib/google/cloud/language.rb +88 -119
- data/lib/google-cloud-language.rb +19 -0
- metadata +74 -44
- data/LICENSE +0 -201
- data/lib/google/cloud/language/v1/credentials.rb +0 -41
- data/lib/google/cloud/language/v1/doc/google/cloud/language/v1/language_service.rb +0 -1039
- data/lib/google/cloud/language/v1/language_service_client.rb +0 -451
- data/lib/google/cloud/language/v1/language_service_client_config.json +0 -56
- data/lib/google/cloud/language/v1/language_service_pb.rb +0 -403
- data/lib/google/cloud/language/v1/language_service_services_pb.rb +0 -64
- data/lib/google/cloud/language/v1.rb +0 -148
- data/lib/google/cloud/language/v1beta2/credentials.rb +0 -41
- data/lib/google/cloud/language/v1beta2/doc/google/cloud/language/v1beta2/language_service.rb +0 -1049
- data/lib/google/cloud/language/v1beta2/language_service_client.rb +0 -451
- data/lib/google/cloud/language/v1beta2/language_service_client_config.json +0 -56
- data/lib/google/cloud/language/v1beta2/language_service_pb.rb +0 -404
- data/lib/google/cloud/language/v1beta2/language_service_services_pb.rb +0 -64
- data/lib/google/cloud/language/v1beta2.rb +0 -160
data/MIGRATING.md
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
## Migrating to google-cloud-language 1.0
|
2
|
+
|
3
|
+
The 1.0 release of the google-cloud-language client is a significant upgrade
|
4
|
+
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
5
|
+
and includes substantial interface changes. Existing code written for earlier
|
6
|
+
versions of this library will likely require updates to use this version.
|
7
|
+
This document describes the changes that have been made, and what you need to
|
8
|
+
do to update your usage.
|
9
|
+
|
10
|
+
To summarize:
|
11
|
+
|
12
|
+
* The library has been broken out into three libraries. The new gems
|
13
|
+
`google-cloud-language-v1` and `google-cloud-language-v1beta2` contain the
|
14
|
+
actual client classes for versions V1 and V1beta2 of the Natural Language
|
15
|
+
service, and the gem `google-cloud-language` now simply provides a
|
16
|
+
convenience wrapper. See [Library Structure](#library-structure) for more
|
17
|
+
info.
|
18
|
+
* The library uses a new configuration mechanism giving you closer control
|
19
|
+
over endpoint address, network timeouts, and retry. See
|
20
|
+
[Client Configuration](#client-configuration) for more info. Furthermore,
|
21
|
+
when creating a client object, you can customize its configuration in a
|
22
|
+
block rather than passing arguments to the constructor. See
|
23
|
+
[Creating Clients](#creating-clients) for more info.
|
24
|
+
* Previously, positional arguments were used to indicate required arguments.
|
25
|
+
Now, all method arguments are keyword arguments, with documentation that
|
26
|
+
specifies whether they are required or optional. Additionally, you can pass
|
27
|
+
a proto request object instead of separate arguments. See
|
28
|
+
[Passing Arguments](#passing-arguments) for more info.
|
29
|
+
* Previously, clients reported RPC errors by raising instances of
|
30
|
+
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
31
|
+
`Google::Cloud::Error` and its subclasses. See
|
32
|
+
[Handling Errors](#handling-errors) for more info.
|
33
|
+
* Some classes have moved into different namespaces. See
|
34
|
+
[Class Namespaces](#class-namespaces) for more info.
|
35
|
+
|
36
|
+
### Library Structure
|
37
|
+
|
38
|
+
Older 0.x releases of the `google-cloud-language` gem were all-in-one gems that
|
39
|
+
included potentially multiple clients for multiple versions of the Natural
|
40
|
+
Language service. The `Google::Cloud::Language.new` factory method would
|
41
|
+
return you an instance of a `Google::Cloud::Language::V1::LanguageServiceClient`
|
42
|
+
object for the V1 version of the service, or a
|
43
|
+
`Google::Cloud::Language::V1beta2::LanguageServiceClient` object for the
|
44
|
+
V1beta2 version of the service. All these classes were defined in the same gem.
|
45
|
+
|
46
|
+
With the 1.0 release, the `google-cloud-language` gem still provides factory
|
47
|
+
methods for obtaining clients. (The method signatures will have changed. See
|
48
|
+
[Creating Clients](#creating-clients) for details.) However, the actual client
|
49
|
+
classes have been moved into separate gems, one per service version. The
|
50
|
+
`Google::Cloud::Language::V1::LanguageService::Client` class, along with its
|
51
|
+
helpers and data types, is now part of the `google-cloud-language-v1` gem.
|
52
|
+
Similarly, the `Google::Cloud::Language::V1beta2::LanguageService::Client`
|
53
|
+
class is part of the `google-cloud-language-v1beta2` gem.
|
54
|
+
|
55
|
+
For normal usage, you can continue to install the `google-cloud-language` gem
|
56
|
+
(which will bring in the versioned client gems as dependencies) and continue to
|
57
|
+
use factory methods to create clients. However, you may alternatively choose to
|
58
|
+
install only one of the versioned gems. For example, if you know you will only
|
59
|
+
`V1` of the service, you can install `google-cloud-language-v1` by itself, and
|
60
|
+
construct instances of the
|
61
|
+
`Google::Cloud::Language::V1::LanguageService::Client` client class directly.
|
62
|
+
|
63
|
+
### Client Configuration
|
64
|
+
|
65
|
+
In older releases, if you wanted to customize performance parameters or
|
66
|
+
low-level behavior of the client (such as credentials, timeouts, or
|
67
|
+
instrumentation), you would pass a variety of keyword arguments to the client
|
68
|
+
constructor. It was also extremely difficult to customize the default settings.
|
69
|
+
|
70
|
+
With the 1.0 release, a configuration interface provides control over these
|
71
|
+
parameters, including defaults for all instances of a client, and settings for
|
72
|
+
each specific client instance. For example, to set default credentials and
|
73
|
+
timeout for all Language V1 clients:
|
74
|
+
|
75
|
+
```
|
76
|
+
Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
77
|
+
config.credentials = "/path/to/credentials.json"
|
78
|
+
config.timeout = 10.0
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
Individual RPCs can also be configured independently. For example, to set the
|
83
|
+
timeout for the `analyze_sentiment` call:
|
84
|
+
|
85
|
+
```
|
86
|
+
Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
87
|
+
config.rpcs.analyze_sentinment.timeout = 20.0
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
Defaults for certain configurations can be set for all Language versions
|
92
|
+
globally:
|
93
|
+
|
94
|
+
```
|
95
|
+
Google::Cloud::Language.configure do |config|
|
96
|
+
config.credentials = "/path/to/credentials.json"
|
97
|
+
config.timeout = 10.0
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
101
|
+
Finally, you can override the configuration for each client instance. See the
|
102
|
+
next section on [Creating Clients](#creating-clients) for details.
|
103
|
+
|
104
|
+
### Creating Clients
|
105
|
+
|
106
|
+
In older releases, to create a client object, you would use the
|
107
|
+
`Google::Cloud::Language.new` class method. Keyword arguments were available to
|
108
|
+
select a service version and to configure parameters such as credentials and
|
109
|
+
timeouts.
|
110
|
+
|
111
|
+
With the 1.0 release, use the `Google::Cloud::Language.language_service` class
|
112
|
+
method to create a client object. You may select a service version using the
|
113
|
+
`:version` keyword argument. However, other configuration parameters should be
|
114
|
+
set in a configuration block when you create the client.
|
115
|
+
|
116
|
+
Old:
|
117
|
+
```
|
118
|
+
client = Google::Cloud::Language.new credentials: "/path/to/credentials.json"
|
119
|
+
```
|
120
|
+
|
121
|
+
New:
|
122
|
+
```
|
123
|
+
client = Google::Cloud::Language.language_service do |config|
|
124
|
+
config.credentials = "/path/to/credentials.json"
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
128
|
+
The configuration block is optional. If you do not provide it, or you do not
|
129
|
+
set some configuration parameters, then the default configuration is used. See
|
130
|
+
[Client Configuration](#client-configuration).
|
131
|
+
|
132
|
+
### Passing Arguments
|
133
|
+
|
134
|
+
In older releases, required arguments would be passed as positional method
|
135
|
+
arguments, while most optional arguments would be passed as keyword arguments.
|
136
|
+
|
137
|
+
With the 1.0 release, all RPC arguments are passed as keyword arguments,
|
138
|
+
regardless of whether they are required or optional. For example:
|
139
|
+
|
140
|
+
Old:
|
141
|
+
```
|
142
|
+
client = Google::Cloud::Language.new
|
143
|
+
|
144
|
+
document = {
|
145
|
+
content: "I love API calls!",
|
146
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
147
|
+
}
|
148
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
149
|
+
|
150
|
+
# Document is a positional argument, while encoding_type is a keyword argument.
|
151
|
+
response = client.analyze_sentiment document, encoding_type: encoding
|
152
|
+
```
|
153
|
+
|
154
|
+
New:
|
155
|
+
```
|
156
|
+
client = Google::Cloud::Language.language_service
|
157
|
+
|
158
|
+
document = {
|
159
|
+
content: "I love API calls!",
|
160
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
161
|
+
}
|
162
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
163
|
+
|
164
|
+
# Both document and encoding_type are keyword arguments.
|
165
|
+
response = client.analyze_sentiment document: document, encoding_type: encoding
|
166
|
+
```
|
167
|
+
|
168
|
+
In the 1.0 release, it is also possible to pass a request object, either
|
169
|
+
as a hash or as a protocol buffer.
|
170
|
+
|
171
|
+
New:
|
172
|
+
```
|
173
|
+
client = Google::Cloud::Language.language_service
|
174
|
+
|
175
|
+
request = Google::Cloud::Language::V1::AnalyzeSentimentRequest.new(
|
176
|
+
document: {
|
177
|
+
content: "I love API calls!",
|
178
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
179
|
+
},
|
180
|
+
encoding_type: Google:Cloud::Language::V1::EncodingType::UTF8
|
181
|
+
)
|
182
|
+
|
183
|
+
# Pass a request object as a positional argument:
|
184
|
+
response = client.analyze_sentiment request
|
185
|
+
```
|
186
|
+
|
187
|
+
Finally, in older releases, to provide call options, you would pass a
|
188
|
+
`Google::Gax::CallOptions` object with the `:options` keyword argument. In the
|
189
|
+
1.0 release, pass call options using a _second set_ of keyword arguments.
|
190
|
+
|
191
|
+
Old:
|
192
|
+
```
|
193
|
+
client = Google::Cloud::Language.new
|
194
|
+
|
195
|
+
document = {
|
196
|
+
content: "I love API calls!",
|
197
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
198
|
+
}
|
199
|
+
|
200
|
+
options = Google::Gax::CallOptions.new timeout: 10.0
|
201
|
+
|
202
|
+
response = client.analyze_sentiment document, options: options
|
203
|
+
```
|
204
|
+
|
205
|
+
New:
|
206
|
+
```
|
207
|
+
client = Google::Cloud::Language.language_service
|
208
|
+
|
209
|
+
document = {
|
210
|
+
content: "I love API calls!",
|
211
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
212
|
+
}
|
213
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
214
|
+
|
215
|
+
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
216
|
+
# then add further keyword arguments for the call options.
|
217
|
+
response = client.analyze_sentiment(
|
218
|
+
{ document: document, encoding_type: encoding },
|
219
|
+
timeout: 10.0
|
220
|
+
)
|
221
|
+
```
|
222
|
+
|
223
|
+
### Handling Errors
|
224
|
+
|
225
|
+
The client reports standard
|
226
|
+
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
227
|
+
by raising exceptions. In older releases, these exceptions were located in the
|
228
|
+
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
229
|
+
exception class, defined in the `google-gax` gem. However, these classes were
|
230
|
+
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
231
|
+
thrown by other client libraries such as `google-cloud-storage`.
|
232
|
+
|
233
|
+
The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
|
234
|
+
for consistency across all the Google Cloud client libraries. In general, these
|
235
|
+
exceptions have the same name as their counterparts from older releases, but
|
236
|
+
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
237
|
+
namespace.
|
238
|
+
|
239
|
+
Old:
|
240
|
+
```
|
241
|
+
client = Google::Cloud::Language.new
|
242
|
+
|
243
|
+
document = {
|
244
|
+
content: "I love API calls!",
|
245
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
246
|
+
}
|
247
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
248
|
+
|
249
|
+
begin
|
250
|
+
response = client.analyze_sentiment document, encoding_type: encoding
|
251
|
+
rescue Google::Gax::Error => e
|
252
|
+
# Handle exceptions that subclass Google::Gax::Error
|
253
|
+
end
|
254
|
+
```
|
255
|
+
|
256
|
+
New:
|
257
|
+
```
|
258
|
+
client = Google::Cloud::Language.language_service
|
259
|
+
|
260
|
+
document = {
|
261
|
+
content: "I love API calls!",
|
262
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
263
|
+
}
|
264
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
265
|
+
|
266
|
+
begin
|
267
|
+
response = client.analyze_sentiment document: document, encoding_type: encoding
|
268
|
+
rescue Google::Cloud::Error => e
|
269
|
+
# Handle exceptions that subclass Google::Cloud::Error
|
270
|
+
end
|
271
|
+
```
|
272
|
+
|
273
|
+
### Class Namespaces
|
274
|
+
|
275
|
+
In older releases, the client object was of class
|
276
|
+
`Google::Cloud::Language::V1::LanguageServiceClient`.
|
277
|
+
In the 1.0 release, the client object is of class
|
278
|
+
`Google::Cloud::Language::V1::LanguageService::Client`.
|
279
|
+
Note that most users will use the `Google::Cloud::Language.language_service`
|
280
|
+
factory method to create instances of the client object, so you may not need to
|
281
|
+
reference the actual class directly.
|
282
|
+
See [Creating Clients](#creating-clients).
|
283
|
+
|
284
|
+
In older releases, the credentials object was of class
|
285
|
+
`Google::Cloud::Language::V1::Credentials`.
|
286
|
+
In the 1.0 release, the credentials object is of class
|
287
|
+
`Google::Cloud::Language::V1::LanguageService::Credentials`.
|
288
|
+
Again, most users will not need to reference this class directly.
|
289
|
+
See [Client Configuration](#client-configuration).
|
data/README.md
CHANGED
@@ -1,43 +1,54 @@
|
|
1
|
-
# Ruby Client for Cloud Natural Language API
|
1
|
+
# Ruby Client for the Cloud Natural Language API
|
2
2
|
|
3
|
-
|
4
|
-
Provides natural language understanding technologies, such as sentiment
|
5
|
-
analysis, entity recognition, entity sentiment analysis, and other text
|
6
|
-
annotations, to developers.
|
7
|
-
- [Client Library Documentation][]
|
8
|
-
- [Product Documentation][]
|
3
|
+
API Client library for the Cloud Natural Language API
|
9
4
|
|
10
|
-
|
11
|
-
In order to use this library, you first need to go through the following
|
12
|
-
steps:
|
5
|
+
Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations.
|
13
6
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
Actual client classes for the various versions of this API are defined in
|
8
|
+
_versioned_ client gems, with names of the form `google-cloud-language-v*`.
|
9
|
+
The gem `google-cloud-language` is the main client library that brings the
|
10
|
+
verisoned gems in as dependencies, and provides high-level methods for
|
11
|
+
constructing clients. More information on versioned clients can be found below
|
12
|
+
in the section titled *Which client should I use?*.
|
13
|
+
|
14
|
+
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-language/latest)
|
15
|
+
for this library, google-cloud-language, to see the convenience methods for
|
16
|
+
constructing client objects. Reference documentation for the client objects
|
17
|
+
themselves can be found in the client library documentation for the versioned
|
18
|
+
client gems:
|
19
|
+
[google-cloud-language-v1](https://googleapis.dev/ruby/google-cloud-language-v1/latest),
|
20
|
+
[google-cloud-language-v1beta2](https://googleapis.dev/ruby/google-cloud-language-v1beta2/latest).
|
21
|
+
|
22
|
+
See also the [Product Documentation](https://cloud.google.com/natural-language)
|
23
|
+
for more usage information.
|
24
|
+
|
25
|
+
## Quick Start
|
18
26
|
|
19
|
-
### Installation
|
20
27
|
```
|
21
28
|
$ gem install google-cloud-language
|
22
29
|
```
|
23
30
|
|
24
|
-
|
25
|
-
- Read the [Client Library Documentation][] for Cloud Natural Language API
|
26
|
-
to see other available methods on the client.
|
27
|
-
- Read the [Cloud Natural Language API Product documentation][Product Documentation]
|
28
|
-
to learn more about the product and see How-to Guides.
|
29
|
-
- View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
30
|
-
to see the full list of Cloud APIs that we cover.
|
31
|
+
In order to use this library, you first need to go through the following steps:
|
31
32
|
|
32
|
-
[
|
33
|
-
[
|
33
|
+
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
+
1. [Enable the API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
|
36
|
+
1. {file:AUTHENTICATION.md Set up authentication.}
|
37
|
+
|
38
|
+
## Migrating from 0.x versions
|
39
|
+
|
40
|
+
The 1.0 release of the google-cloud-language client is a significant upgrade
|
41
|
+
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
42
|
+
and includes substantial interface changes. Existing code written for earlier
|
43
|
+
versions of this library will likely require updates to use this version.
|
44
|
+
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
34
45
|
|
35
46
|
## Enabling Logging
|
36
47
|
|
37
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
38
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
|
39
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
40
|
-
that will write logs to [
|
51
|
+
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
41
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
42
53
|
|
43
54
|
Configuring a Ruby stdlib logger:
|
@@ -60,11 +71,69 @@ end
|
|
60
71
|
|
61
72
|
## Supported Ruby Versions
|
62
73
|
|
63
|
-
This library is supported on Ruby 2.
|
74
|
+
This library is supported on Ruby 2.6+.
|
64
75
|
|
65
76
|
Google provides official support for Ruby versions that are actively supported
|
66
77
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
67
|
-
in security maintenance, and not end of life.
|
68
|
-
|
69
|
-
|
70
|
-
|
78
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
79
|
+
still work, but are unsupported and not recommended. See
|
80
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
81
|
+
support schedule.
|
82
|
+
|
83
|
+
## Which client should I use?
|
84
|
+
|
85
|
+
Most modern Ruby client libraries for Google APIs come in two flavors: the main
|
86
|
+
client library with a name such as `google-cloud-language`,
|
87
|
+
and lower-level _versioned_ client libraries with names such as
|
88
|
+
`google-cloud-language-v1`.
|
89
|
+
_In most cases, you should install the main client._
|
90
|
+
|
91
|
+
### What's the difference between the main client and a versioned client?
|
92
|
+
|
93
|
+
A _versioned client_ provides a basic set of data types and client classes for
|
94
|
+
a _single version_ of a specific service. (That is, for a service with multiple
|
95
|
+
versions, there might be a separate versioned client for each service version.)
|
96
|
+
Most versioned clients are written and maintained by a code generator.
|
97
|
+
|
98
|
+
The _main client_ is designed to provide you with the _recommended_ client
|
99
|
+
interfaces for the service. There will be only one main client for any given
|
100
|
+
service, even a service with multiple versions. The main client includes
|
101
|
+
factory methods for constructing the client objects we recommend for most
|
102
|
+
users. In some cases, those will be classes provided by an underlying versioned
|
103
|
+
client; in other cases, they will be handwritten higher-level client objects
|
104
|
+
with additional capabilities, convenience methods, or best practices built in.
|
105
|
+
Generally, the main client will default to a recommended service version,
|
106
|
+
although in some cases you can override this if you need to talk to a specific
|
107
|
+
service version.
|
108
|
+
|
109
|
+
### Why would I want to use the main client?
|
110
|
+
|
111
|
+
We recommend that most users install the main client gem for a service. You can
|
112
|
+
identify this gem as the one _without_ a version in its name, e.g.
|
113
|
+
`google-cloud-language`.
|
114
|
+
The main client is recommended because it will embody the best practices for
|
115
|
+
accessing the service, and may also provide more convenient interfaces or
|
116
|
+
tighter integration into frameworks and third-party libraries. In addition, the
|
117
|
+
documentation and samples published by Google will generally demonstrate use of
|
118
|
+
the main client.
|
119
|
+
|
120
|
+
### Why would I want to use a versioned client?
|
121
|
+
|
122
|
+
You can use a versioned client if you are content with a possibly lower-level
|
123
|
+
class interface, you explicitly want to avoid features provided by the main
|
124
|
+
client, or you want to access a specific service version not be covered by the
|
125
|
+
main client. You can identify versioned client gems because the service version
|
126
|
+
is part of the name, e.g. `google-cloud-language-v1`.
|
127
|
+
|
128
|
+
### What about the google-apis-<name> clients?
|
129
|
+
|
130
|
+
Client library gems with names that begin with `google-apis-` are based on an
|
131
|
+
older code generation technology. They talk to a REST/JSON backend (whereas
|
132
|
+
most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
|
133
|
+
not offer the same performance, features, and ease of use provided by more
|
134
|
+
modern clients.
|
135
|
+
|
136
|
+
The `google-apis-` clients have wide coverage across Google services, so you
|
137
|
+
might need to use one if there is no modern client available for the service.
|
138
|
+
However, if a modern client is available, we generally recommend it over the
|
139
|
+
older `google-apis-` clients.
|