google-cloud-speech-v1p1beta1 0.1.2 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +1 -1
- data/lib/google/cloud/speech/v1p1beta1.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +5 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb +1 -2
- data/lib/google/cloud/speech/v1p1beta1/resource_pb.rb +46 -0
- data/lib/google/cloud/speech/v1p1beta1/speech.rb +2 -1
- data/lib/google/cloud/speech/v1p1beta1/speech/client.rb +106 -91
- data/lib/google/cloud/speech/v1p1beta1/speech/credentials.rb +1 -1
- data/lib/google/cloud/speech/v1p1beta1/speech/operations.rb +109 -103
- data/lib/google/cloud/speech/v1p1beta1/speech/paths.rb +71 -0
- data/lib/google/cloud/speech/v1p1beta1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/speech/v1p1beta1/cloud_speech.rb +141 -126
- data/proto_docs/google/cloud/speech/v1p1beta1/resource.rb +133 -0
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/duration.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- data/proto_docs/google/rpc/status.rb +6 -6
- metadata +36 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4346e0f1d24fb7d748af745981651fcdc69ad0bad4b9e46e05c2452729bebf8d
|
4
|
+
data.tar.gz: f1d01875e5f50421676da998da6eea4bb252c5d723c149c77ac185fae8d87c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bf7d968edd3157914404a1063fe3750c41a1fdcdf49d2964ec2b19a65f0d41c1c512c88e2eebe1104bdc48528f74d01ecc693c4cdeed5629dbc085227d0bbcf
|
7
|
+
data.tar.gz: 9c43926b71f33744fcf3321566d064d0ea65cbbe325502705c947ac061271a743b5f41c7be1a9583a920df48de5bb00234729d277f402ea1fd5bef6d84a1ec86
|
data/AUTHENTICATION.md
CHANGED
@@ -27,7 +27,7 @@ export SPEECH_CREDENTIALS=path/to/keyfile.json
|
|
27
27
|
```ruby
|
28
28
|
require "google/cloud/speech/v1p1beta1"
|
29
29
|
|
30
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
30
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
31
31
|
```
|
32
32
|
|
33
33
|
## Credential Lookup
|
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
|
|
64
64
|
|
65
65
|
The environment variables that google-cloud-speech-v1p1beta1
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
{Google::Cloud::Speech::V1p1beta1::Speech::Credentials}):
|
67
|
+
{::Google::Cloud::Speech::V1p1beta1::Speech::Credentials}):
|
68
68
|
|
69
69
|
1. `SPEECH_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
70
|
2. `SPEECH_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -77,7 +77,7 @@ require "google/cloud/speech/v1p1beta1"
|
|
77
77
|
|
78
78
|
ENV["SPEECH_CREDENTIALS"] = "path/to/keyfile.json"
|
79
79
|
|
80
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
80
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
81
81
|
```
|
82
82
|
|
83
83
|
### Configuration
|
@@ -88,7 +88,7 @@ environment variables. Either on an individual client initialization:
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/speech/v1p1beta1"
|
90
90
|
|
91
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
91
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
92
92
|
config.credentials = "path/to/keyfile.json"
|
93
93
|
end
|
94
94
|
```
|
@@ -98,11 +98,11 @@ Or configured globally for all clients:
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/speech/v1p1beta1"
|
100
100
|
|
101
|
-
Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
101
|
+
::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
102
102
|
config.credentials = "path/to/keyfile.json"
|
103
103
|
end
|
104
104
|
|
105
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
105
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
106
106
|
```
|
107
107
|
|
108
108
|
### Cloud SDK
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ In order to use this library, you first need to go through the following steps:
|
|
25
25
|
```ruby
|
26
26
|
require "google/cloud/speech/v1p1beta1"
|
27
27
|
|
28
|
-
client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
28
|
+
client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
29
29
|
request = my_create_request
|
30
30
|
response = client.recognize request
|
31
31
|
```
|
@@ -26,7 +26,7 @@ module Google
|
|
26
26
|
# To load this package, including all its services, and instantiate a client:
|
27
27
|
#
|
28
28
|
# require "google/cloud/speech/v1p1beta1"
|
29
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
29
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
30
30
|
#
|
31
31
|
module V1p1beta1
|
32
32
|
end
|
@@ -6,6 +6,8 @@ require 'google/protobuf'
|
|
6
6
|
require 'google/api/annotations_pb'
|
7
7
|
require 'google/api/client_pb'
|
8
8
|
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/speech/v1p1beta1/resource_pb'
|
9
11
|
require 'google/longrunning/operations_pb'
|
10
12
|
require 'google/protobuf/any_pb'
|
11
13
|
require 'google/protobuf/duration_pb'
|
@@ -41,6 +43,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
41
43
|
repeated :alternative_language_codes, :string, 18
|
42
44
|
optional :max_alternatives, :int32, 4
|
43
45
|
optional :profanity_filter, :bool, 5
|
46
|
+
optional :adaptation, :message, 20, "google.cloud.speech.v1p1beta1.SpeechAdaptation"
|
44
47
|
repeated :speech_contexts, :message, 6, "google.cloud.speech.v1p1beta1.SpeechContext"
|
45
48
|
optional :enable_word_time_offsets, :bool, 8
|
46
49
|
optional :enable_word_confidence, :bool, 15
|
@@ -67,6 +70,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
67
70
|
optional :enable_speaker_diarization, :bool, 1
|
68
71
|
optional :min_speaker_count, :int32, 2
|
69
72
|
optional :max_speaker_count, :int32, 3
|
73
|
+
optional :speaker_tag, :int32, 5
|
70
74
|
end
|
71
75
|
add_message "google.cloud.speech.v1p1beta1.RecognitionMetadata" do
|
72
76
|
optional :interaction_type, :enum, 1, "google.cloud.speech.v1p1beta1.RecognitionMetadata.InteractionType"
|
@@ -130,6 +134,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
130
134
|
optional :progress_percent, :int32, 1
|
131
135
|
optional :start_time, :message, 2, "google.protobuf.Timestamp"
|
132
136
|
optional :last_update_time, :message, 3, "google.protobuf.Timestamp"
|
137
|
+
optional :uri, :string, 4
|
133
138
|
end
|
134
139
|
add_message "google.cloud.speech.v1p1beta1.StreamingRecognizeResponse" do
|
135
140
|
optional :error, :message, 1, "google.rpc.Status"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/cloud/speech/v1p1beta1/cloud_speech.proto for package 'google.cloud.speech.v1p1beta1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2020 Google LLC
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -15,7 +15,6 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
#
|
19
18
|
|
20
19
|
require 'grpc'
|
21
20
|
require 'google/cloud/speech/v1p1beta1/cloud_speech_pb'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/speech/v1p1beta1/resource.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/resource_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/speech/v1p1beta1/resource.proto", :syntax => :proto3) do
|
10
|
+
add_message "google.cloud.speech.v1p1beta1.CustomClass" do
|
11
|
+
optional :name, :string, 1
|
12
|
+
optional :custom_class_id, :string, 2
|
13
|
+
repeated :items, :message, 3, "google.cloud.speech.v1p1beta1.CustomClass.ClassItem"
|
14
|
+
end
|
15
|
+
add_message "google.cloud.speech.v1p1beta1.CustomClass.ClassItem" do
|
16
|
+
optional :value, :string, 1
|
17
|
+
end
|
18
|
+
add_message "google.cloud.speech.v1p1beta1.PhraseSet" do
|
19
|
+
optional :name, :string, 1
|
20
|
+
repeated :phrases, :message, 2, "google.cloud.speech.v1p1beta1.PhraseSet.Phrase"
|
21
|
+
optional :boost, :float, 4
|
22
|
+
end
|
23
|
+
add_message "google.cloud.speech.v1p1beta1.PhraseSet.Phrase" do
|
24
|
+
optional :value, :string, 1
|
25
|
+
optional :boost, :float, 2
|
26
|
+
end
|
27
|
+
add_message "google.cloud.speech.v1p1beta1.SpeechAdaptation" do
|
28
|
+
repeated :phrase_sets, :message, 1, "google.cloud.speech.v1p1beta1.PhraseSet"
|
29
|
+
repeated :custom_classes, :message, 2, "google.cloud.speech.v1p1beta1.CustomClass"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module Google
|
35
|
+
module Cloud
|
36
|
+
module Speech
|
37
|
+
module V1p1beta1
|
38
|
+
CustomClass = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.CustomClass").msgclass
|
39
|
+
CustomClass::ClassItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.CustomClass.ClassItem").msgclass
|
40
|
+
PhraseSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.PhraseSet").msgclass
|
41
|
+
PhraseSet::Phrase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.PhraseSet.Phrase").msgclass
|
42
|
+
SpeechAdaptation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1p1beta1.SpeechAdaptation").msgclass
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -23,6 +23,7 @@ require "gapic/config/method"
|
|
23
23
|
require "google/cloud/speech/v1p1beta1/version"
|
24
24
|
|
25
25
|
require "google/cloud/speech/v1p1beta1/speech/credentials"
|
26
|
+
require "google/cloud/speech/v1p1beta1/speech/paths"
|
26
27
|
require "google/cloud/speech/v1p1beta1/speech/operations"
|
27
28
|
require "google/cloud/speech/v1p1beta1/speech/client"
|
28
29
|
|
@@ -36,7 +37,7 @@ module Google
|
|
36
37
|
# To load this service and instantiate a client:
|
37
38
|
#
|
38
39
|
# require "google/cloud/speech/v1p1beta1/speech"
|
39
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
40
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
40
41
|
#
|
41
42
|
module Speech
|
42
43
|
end
|
@@ -30,21 +30,23 @@ module Google
|
|
30
30
|
# Service that implements Google Cloud Speech API.
|
31
31
|
#
|
32
32
|
class Client
|
33
|
+
include Paths
|
34
|
+
|
33
35
|
# @private
|
34
36
|
attr_reader :speech_stub
|
35
37
|
|
36
38
|
##
|
37
39
|
# Configure the Speech Client class.
|
38
40
|
#
|
39
|
-
# See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
41
|
+
# See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
40
42
|
# for a description of the configuration fields.
|
41
43
|
#
|
42
44
|
# ## Example
|
43
45
|
#
|
44
46
|
# To modify the configuration for all Speech clients:
|
45
47
|
#
|
46
|
-
# Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
47
|
-
# config.timeout =
|
48
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
48
50
|
# end
|
49
51
|
#
|
50
52
|
# @yield [config] Configure the Client client.
|
@@ -94,7 +96,7 @@ module Google
|
|
94
96
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
95
97
|
# should be made on {Client.configure}.
|
96
98
|
#
|
97
|
-
# See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
99
|
+
# See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
|
98
100
|
# for a description of the configuration fields.
|
99
101
|
#
|
100
102
|
# @yield [config] Configure the Client client.
|
@@ -115,13 +117,13 @@ module Google
|
|
115
117
|
# To create a new Speech client with the default
|
116
118
|
# configuration:
|
117
119
|
#
|
118
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
120
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
|
119
121
|
#
|
120
122
|
# To create a new Speech client with a custom
|
121
123
|
# configuration:
|
122
124
|
#
|
123
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
124
|
-
# config.timeout =
|
125
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
126
|
+
# config.timeout = 10.0
|
125
127
|
# end
|
126
128
|
#
|
127
129
|
# @yield [config] Configure the Speech client.
|
@@ -146,14 +148,16 @@ module Google
|
|
146
148
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
147
149
|
credentials = Credentials.new credentials, scope: @config.scope
|
148
150
|
end
|
149
|
-
@quota_project_id =
|
151
|
+
@quota_project_id = @config.quota_project
|
152
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
150
153
|
|
151
154
|
@operations_client = Operations.new do |config|
|
152
155
|
config.credentials = credentials
|
156
|
+
config.endpoint = @config.endpoint
|
153
157
|
end
|
154
158
|
|
155
|
-
@speech_stub = Gapic::ServiceStub.new(
|
156
|
-
Google::Cloud::Speech::V1p1beta1::Speech::Stub,
|
159
|
+
@speech_stub = ::Gapic::ServiceStub.new(
|
160
|
+
::Google::Cloud::Speech::V1p1beta1::Speech::Stub,
|
157
161
|
credentials: credentials,
|
158
162
|
endpoint: @config.endpoint,
|
159
163
|
channel_args: @config.channel_args,
|
@@ -161,6 +165,13 @@ module Google
|
|
161
165
|
)
|
162
166
|
end
|
163
167
|
|
168
|
+
##
|
169
|
+
# Get the associated client for long-running operations.
|
170
|
+
#
|
171
|
+
# @return [::Google::Cloud::Speech::V1p1beta1::Speech::Operations]
|
172
|
+
#
|
173
|
+
attr_reader :operations_client
|
174
|
+
|
164
175
|
# Service calls
|
165
176
|
|
166
177
|
##
|
@@ -169,12 +180,12 @@ module Google
|
|
169
180
|
#
|
170
181
|
# @overload recognize(request, options = nil)
|
171
182
|
# Pass arguments to `recognize` via a request object, either of type
|
172
|
-
# {Google::Cloud::Speech::V1p1beta1::RecognizeRequest} or an equivalent Hash.
|
183
|
+
# {::Google::Cloud::Speech::V1p1beta1::RecognizeRequest} or an equivalent Hash.
|
173
184
|
#
|
174
|
-
# @param request [Google::Cloud::Speech::V1p1beta1::RecognizeRequest, Hash]
|
185
|
+
# @param request [::Google::Cloud::Speech::V1p1beta1::RecognizeRequest, ::Hash]
|
175
186
|
# A request object representing the call parameters. Required. To specify no
|
176
187
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
177
|
-
# @param options [Gapic::CallOptions, Hash]
|
188
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
178
189
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
179
190
|
#
|
180
191
|
# @overload recognize(config: nil, audio: nil)
|
@@ -182,33 +193,33 @@ module Google
|
|
182
193
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
183
194
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
184
195
|
#
|
185
|
-
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig, Hash]
|
196
|
+
# @param config [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig, ::Hash]
|
186
197
|
# Required. Provides information to the recognizer that specifies how to
|
187
198
|
# process the request.
|
188
|
-
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio, Hash]
|
199
|
+
# @param audio [::Google::Cloud::Speech::V1p1beta1::RecognitionAudio, ::Hash]
|
189
200
|
# Required. The audio data to be recognized.
|
190
201
|
#
|
191
202
|
# @yield [response, operation] Access the result along with the RPC operation
|
192
|
-
# @yieldparam response [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
193
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
203
|
+
# @yieldparam response [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
204
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
194
205
|
#
|
195
|
-
# @return [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
206
|
+
# @return [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
196
207
|
#
|
197
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
208
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
198
209
|
#
|
199
210
|
def recognize request, options = nil
|
200
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
211
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
201
212
|
|
202
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::RecognizeRequest
|
213
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::RecognizeRequest
|
203
214
|
|
204
215
|
# Converts hash and nil to an options object
|
205
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
216
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
206
217
|
|
207
218
|
# Customize the options with defaults
|
208
219
|
metadata = @config.rpcs.recognize.metadata.to_h
|
209
220
|
|
210
221
|
# Set x-goog-api-client and x-goog-user-project headers
|
211
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
222
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
212
223
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
213
224
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
214
225
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -223,8 +234,8 @@ module Google
|
|
223
234
|
yield response, operation if block_given?
|
224
235
|
return response
|
225
236
|
end
|
226
|
-
rescue GRPC::BadStatus => e
|
227
|
-
raise Google::Cloud::Error.from_error(e)
|
237
|
+
rescue ::GRPC::BadStatus => e
|
238
|
+
raise ::Google::Cloud::Error.from_error(e)
|
228
239
|
end
|
229
240
|
|
230
241
|
##
|
@@ -237,12 +248,12 @@ module Google
|
|
237
248
|
#
|
238
249
|
# @overload long_running_recognize(request, options = nil)
|
239
250
|
# Pass arguments to `long_running_recognize` via a request object, either of type
|
240
|
-
# {Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest} or an equivalent Hash.
|
251
|
+
# {::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest} or an equivalent Hash.
|
241
252
|
#
|
242
|
-
# @param request [Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest, Hash]
|
253
|
+
# @param request [::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest, ::Hash]
|
243
254
|
# A request object representing the call parameters. Required. To specify no
|
244
255
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
245
|
-
# @param options [Gapic::CallOptions, Hash]
|
256
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
246
257
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
247
258
|
#
|
248
259
|
# @overload long_running_recognize(config: nil, audio: nil)
|
@@ -250,33 +261,33 @@ module Google
|
|
250
261
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
251
262
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
252
263
|
#
|
253
|
-
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig, Hash]
|
264
|
+
# @param config [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig, ::Hash]
|
254
265
|
# Required. Provides information to the recognizer that specifies how to
|
255
266
|
# process the request.
|
256
|
-
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio, Hash]
|
267
|
+
# @param audio [::Google::Cloud::Speech::V1p1beta1::RecognitionAudio, ::Hash]
|
257
268
|
# Required. The audio data to be recognized.
|
258
269
|
#
|
259
270
|
# @yield [response, operation] Access the result along with the RPC operation
|
260
|
-
# @yieldparam response [Gapic::Operation]
|
261
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
271
|
+
# @yieldparam response [::Gapic::Operation]
|
272
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
262
273
|
#
|
263
|
-
# @return [Gapic::Operation]
|
274
|
+
# @return [::Gapic::Operation]
|
264
275
|
#
|
265
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
276
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
266
277
|
#
|
267
278
|
def long_running_recognize request, options = nil
|
268
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
279
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
269
280
|
|
270
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
|
281
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
|
271
282
|
|
272
283
|
# Converts hash and nil to an options object
|
273
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
284
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
274
285
|
|
275
286
|
# Customize the options with defaults
|
276
287
|
metadata = @config.rpcs.long_running_recognize.metadata.to_h
|
277
288
|
|
278
289
|
# Set x-goog-api-client and x-goog-user-project headers
|
279
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
290
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
280
291
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
281
292
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
282
293
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -288,49 +299,49 @@ module Google
|
|
288
299
|
retry_policy: @config.retry_policy
|
289
300
|
|
290
301
|
@speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
|
291
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
302
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
292
303
|
yield response, operation if block_given?
|
293
304
|
return response
|
294
305
|
end
|
295
|
-
rescue GRPC::BadStatus => e
|
296
|
-
raise Google::Cloud::Error.from_error(e)
|
306
|
+
rescue ::GRPC::BadStatus => e
|
307
|
+
raise ::Google::Cloud::Error.from_error(e)
|
297
308
|
end
|
298
309
|
|
299
310
|
##
|
300
311
|
# Performs bidirectional streaming speech recognition: receive results while
|
301
312
|
# sending audio. This method is only available via the gRPC API (not REST).
|
302
313
|
#
|
303
|
-
# @param request [Gapic::StreamInput, Enumerable
|
304
|
-
# An enumerable of {Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest} instances.
|
305
|
-
# @param options [Gapic::CallOptions, Hash]
|
314
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest, ::Hash>]
|
315
|
+
# An enumerable of {::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest} instances.
|
316
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
306
317
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
307
318
|
#
|
308
319
|
# @yield [response, operation] Access the result along with the RPC operation
|
309
|
-
# @yieldparam response [Enumerable
|
310
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
320
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
|
321
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
311
322
|
#
|
312
|
-
# @return [Enumerable
|
323
|
+
# @return [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
|
313
324
|
#
|
314
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
325
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
315
326
|
#
|
316
327
|
def streaming_recognize request, options = nil
|
317
|
-
unless request.is_a? Enumerable
|
318
|
-
raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
328
|
+
unless request.is_a? ::Enumerable
|
329
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
319
330
|
request = request.to_enum
|
320
331
|
end
|
321
332
|
|
322
333
|
request = request.lazy.map do |req|
|
323
|
-
Gapic::Protobuf.coerce req, to: Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
|
334
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
|
324
335
|
end
|
325
336
|
|
326
337
|
# Converts hash and nil to an options object
|
327
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
338
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
328
339
|
|
329
340
|
# Customize the options with defaults
|
330
341
|
metadata = @config.rpcs.streaming_recognize.metadata.to_h
|
331
342
|
|
332
343
|
# Set x-goog-api-client and x-goog-user-project headers
|
333
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
344
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
334
345
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
335
346
|
gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
|
336
347
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -345,8 +356,8 @@ module Google
|
|
345
356
|
yield response, operation if block_given?
|
346
357
|
return response
|
347
358
|
end
|
348
|
-
rescue GRPC::BadStatus => e
|
349
|
-
raise Google::Cloud::Error.from_error(e)
|
359
|
+
rescue ::GRPC::BadStatus => e
|
360
|
+
raise ::Google::Cloud::Error.from_error(e)
|
350
361
|
end
|
351
362
|
|
352
363
|
##
|
@@ -356,7 +367,7 @@ module Google
|
|
356
367
|
# providing control over timeouts, retry behavior, logging, transport
|
357
368
|
# parameters, and other low-level controls. Certain parameters can also be
|
358
369
|
# applied individually to specific RPCs. See
|
359
|
-
# {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
|
370
|
+
# {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
|
360
371
|
# for a list of RPCs that can be configured independently.
|
361
372
|
#
|
362
373
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -367,22 +378,22 @@ module Google
|
|
367
378
|
# To modify the global config, setting the timeout for recognize
|
368
379
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
369
380
|
#
|
370
|
-
# Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
371
|
-
# config.timeout =
|
372
|
-
# config.rpcs.recognize.timeout =
|
381
|
+
# ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
|
382
|
+
# config.timeout = 10.0
|
383
|
+
# config.rpcs.recognize.timeout = 20.0
|
373
384
|
# end
|
374
385
|
#
|
375
386
|
# To apply the above configuration only to a new client:
|
376
387
|
#
|
377
|
-
# client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
378
|
-
# config.timeout =
|
379
|
-
# config.rpcs.recognize.timeout =
|
388
|
+
# client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
|
389
|
+
# config.timeout = 10.0
|
390
|
+
# config.rpcs.recognize.timeout = 20.0
|
380
391
|
# end
|
381
392
|
#
|
382
393
|
# @!attribute [rw] endpoint
|
383
394
|
# The hostname or hostname:port of the service endpoint.
|
384
395
|
# Defaults to `"speech.googleapis.com"`.
|
385
|
-
# @return [String]
|
396
|
+
# @return [::String]
|
386
397
|
# @!attribute [rw] credentials
|
387
398
|
# Credentials to send with calls. You may provide any of the following types:
|
388
399
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -394,29 +405,29 @@ module Google
|
|
394
405
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
395
406
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
396
407
|
# * (`nil`) indicating no credentials
|
397
|
-
# @return [Object]
|
408
|
+
# @return [::Object]
|
398
409
|
# @!attribute [rw] scope
|
399
410
|
# The OAuth scopes
|
400
|
-
# @return [Array
|
411
|
+
# @return [::Array<::String>]
|
401
412
|
# @!attribute [rw] lib_name
|
402
413
|
# The library name as recorded in instrumentation and logging
|
403
|
-
# @return [String]
|
414
|
+
# @return [::String]
|
404
415
|
# @!attribute [rw] lib_version
|
405
416
|
# The library version as recorded in instrumentation and logging
|
406
|
-
# @return [String]
|
417
|
+
# @return [::String]
|
407
418
|
# @!attribute [rw] channel_args
|
408
419
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
409
420
|
# `GRPC::Core::Channel` object is provided as the credential.
|
410
|
-
# @return [Hash]
|
421
|
+
# @return [::Hash]
|
411
422
|
# @!attribute [rw] interceptors
|
412
423
|
# An array of interceptors that are run before calls are executed.
|
413
|
-
# @return [Array
|
424
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
414
425
|
# @!attribute [rw] timeout
|
415
|
-
# The call timeout in
|
416
|
-
# @return [Numeric]
|
426
|
+
# The call timeout in seconds.
|
427
|
+
# @return [::Numeric]
|
417
428
|
# @!attribute [rw] metadata
|
418
429
|
# Additional gRPC headers to be sent with the call.
|
419
|
-
# @return [Hash{Symbol
|
430
|
+
# @return [::Hash{::Symbol=>::String}]
|
420
431
|
# @!attribute [rw] retry_policy
|
421
432
|
# The retry policy. The value is a hash with the following keys:
|
422
433
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -424,25 +435,29 @@ module Google
|
|
424
435
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
425
436
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
426
437
|
# trigger a retry.
|
427
|
-
# @return [Hash]
|
438
|
+
# @return [::Hash]
|
439
|
+
# @!attribute [rw] quota_project
|
440
|
+
# A separate project against which to charge quota.
|
441
|
+
# @return [::String]
|
428
442
|
#
|
429
443
|
class Configuration
|
430
|
-
extend Gapic::Config
|
444
|
+
extend ::Gapic::Config
|
431
445
|
|
432
|
-
config_attr :endpoint,
|
433
|
-
config_attr :credentials,
|
446
|
+
config_attr :endpoint, "speech.googleapis.com", ::String
|
447
|
+
config_attr :credentials, nil do |value|
|
434
448
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
435
449
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
436
450
|
allowed.any? { |klass| klass === value }
|
437
451
|
end
|
438
|
-
config_attr :scope,
|
439
|
-
config_attr :lib_name,
|
440
|
-
config_attr :lib_version,
|
441
|
-
config_attr(:channel_args,
|
442
|
-
config_attr :interceptors,
|
443
|
-
config_attr :timeout,
|
444
|
-
config_attr :metadata,
|
445
|
-
config_attr :retry_policy,
|
452
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
453
|
+
config_attr :lib_name, nil, ::String, nil
|
454
|
+
config_attr :lib_version, nil, ::String, nil
|
455
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
456
|
+
config_attr :interceptors, nil, ::Array, nil
|
457
|
+
config_attr :timeout, nil, ::Numeric, nil
|
458
|
+
config_attr :metadata, nil, ::Hash, nil
|
459
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
460
|
+
config_attr :quota_project, nil, ::String, nil
|
446
461
|
|
447
462
|
# @private
|
448
463
|
def initialize parent_config = nil
|
@@ -458,7 +473,7 @@ module Google
|
|
458
473
|
def rpcs
|
459
474
|
@rpcs ||= begin
|
460
475
|
parent_rpcs = nil
|
461
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
476
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
462
477
|
Rpcs.new parent_rpcs
|
463
478
|
end
|
464
479
|
end
|
@@ -483,28 +498,28 @@ module Google
|
|
483
498
|
class Rpcs
|
484
499
|
##
|
485
500
|
# RPC-specific configuration for `recognize`
|
486
|
-
# @return [Gapic::Config::Method]
|
501
|
+
# @return [::Gapic::Config::Method]
|
487
502
|
#
|
488
503
|
attr_reader :recognize
|
489
504
|
##
|
490
505
|
# RPC-specific configuration for `long_running_recognize`
|
491
|
-
# @return [Gapic::Config::Method]
|
506
|
+
# @return [::Gapic::Config::Method]
|
492
507
|
#
|
493
508
|
attr_reader :long_running_recognize
|
494
509
|
##
|
495
510
|
# RPC-specific configuration for `streaming_recognize`
|
496
|
-
# @return [Gapic::Config::Method]
|
511
|
+
# @return [::Gapic::Config::Method]
|
497
512
|
#
|
498
513
|
attr_reader :streaming_recognize
|
499
514
|
|
500
515
|
# @private
|
501
516
|
def initialize parent_rpcs = nil
|
502
517
|
recognize_config = parent_rpcs&.recognize if parent_rpcs&.respond_to? :recognize
|
503
|
-
@recognize = Gapic::Config::Method.new recognize_config
|
518
|
+
@recognize = ::Gapic::Config::Method.new recognize_config
|
504
519
|
long_running_recognize_config = parent_rpcs&.long_running_recognize if parent_rpcs&.respond_to? :long_running_recognize
|
505
|
-
@long_running_recognize = Gapic::Config::Method.new long_running_recognize_config
|
520
|
+
@long_running_recognize = ::Gapic::Config::Method.new long_running_recognize_config
|
506
521
|
streaming_recognize_config = parent_rpcs&.streaming_recognize if parent_rpcs&.respond_to? :streaming_recognize
|
507
|
-
@streaming_recognize = Gapic::Config::Method.new streaming_recognize_config
|
522
|
+
@streaming_recognize = ::Gapic::Config::Method.new streaming_recognize_config
|
508
523
|
|
509
524
|
yield self if block_given?
|
510
525
|
end
|