google-cloud-speech-v1p1beta1 0.1.1 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9f64648fce116e6454625687872ead20b4492ded325ddd341c93b3fc67dcc21
4
- data.tar.gz: 8a85608ac077f1e3a41edee203e81a6744267cdcf4ebe76cc4cfe420cecb5034
3
+ metadata.gz: a38f59a73d43386244db111a8513ef20ccd42b6603db40011466a22d086efa83
4
+ data.tar.gz: 72a9fb92532624ab6ba57c458d58223e12a0432842549b5b19cad52251dc2c0c
5
5
  SHA512:
6
- metadata.gz: 00ec80572357ce3e2d29859b7febb485e23046f380414898fe2499ac264e42c41c278f9134b5f0cacc94ee2df7a16fa5692b9bfa559554dc3d8f48c57d1a727f
7
- data.tar.gz: 9b86938fd56b356b4c0876412b426a543965524ee92f8c3ef29477c8104d6513de48e1f308228ac79bf01500588c51501306b3387e9c534f2f6eef852e0a1a68
6
+ metadata.gz: cdd7ae93409b4a1da7f15773ef7bfb10258733ff460a78a44e2783ab582346e6063bfd69cf618d250de56f73476ba17f30368106a277d59292da7811f949d29a
7
+ data.tar.gz: 2686104b93a98bf418093e98d3ff92b84d3f42c2b1fadc85acb0ca67bb63e7ea3465b0625957f610d9dac5080a6153d73c267f2ac8341bdc380f1711ab5d45ef
@@ -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
@@ -1,4 +1,4 @@
1
- # Cloud Speech-to-Text V1p1beta1
1
+ # Ruby Client for the Cloud Speech-to-Text V1p1beta1 API
2
2
 
3
3
  API Client library for the Cloud Speech-to-Text V1p1beta1 API
4
4
 
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
12
12
  $ gem install google-cloud-speech-v1p1beta1
13
13
  ```
14
14
 
15
+ ## Before You Begin
16
+
17
+ In order to use this library, you first need to go through the following steps:
18
+
19
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
20
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
21
+ 1. {file:AUTHENTICATION.md Set up authentication.}
22
+
23
+ ## Quick Start
24
+
25
+ ```ruby
26
+ require "google/cloud/speech/v1p1beta1"
27
+
28
+ client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
29
+ request = my_create_request
30
+ response = client.recognize request
31
+ ```
32
+
33
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-speech-v1p1beta1/latest)
34
+ for class and method documentation.
35
+
36
+ ## Enabling Logging
37
+
38
+ To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
39
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
40
+ or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
41
+ 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)
42
+ and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
43
+
44
+ Configuring a Ruby stdlib logger:
45
+
46
+ ```ruby
47
+ require "logger"
48
+
49
+ module MyLogger
50
+ LOGGER = Logger.new $stderr, level: Logger::WARN
51
+ def logger
52
+ LOGGER
53
+ end
54
+ end
55
+
56
+ # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
57
+ module GRPC
58
+ extend MyLogger
59
+ end
60
+ ```
61
+
15
62
  ## Supported Ruby Versions
16
63
 
17
64
  This library is supported on Ruby 2.4+.
@@ -1 +1,21 @@
1
- require "google/cloud/speech/v1p1beta1/version"
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/speech/v1p1beta1"
@@ -17,3 +17,19 @@
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
19
  require "google/cloud/speech/v1p1beta1/speech"
20
+ require "google/cloud/speech/v1p1beta1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Speech
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/speech/v1p1beta1"
29
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
30
+ #
31
+ module V1p1beta1
32
+ end
33
+ end
34
+ end
35
+ 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 2019 Google LLC.
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
@@ -16,6 +16,35 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "google/cloud/speech/v1p1beta1/speech/client"
20
- require "google/cloud/speech/v1p1beta1/speech/operations"
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/speech/v1p1beta1/version"
24
+
21
25
  require "google/cloud/speech/v1p1beta1/speech/credentials"
26
+ require "google/cloud/speech/v1p1beta1/speech/paths"
27
+ require "google/cloud/speech/v1p1beta1/speech/operations"
28
+ require "google/cloud/speech/v1p1beta1/speech/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Speech
33
+ module V1p1beta1
34
+ ##
35
+ # Service that implements Google Cloud Speech API.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/speech/v1p1beta1/speech"
40
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
41
+ #
42
+ module Speech
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "speech", "helpers.rb"
50
+ require "google/cloud/speech/v1p1beta1/speech/helpers" if ::File.file? helper_path
@@ -16,15 +16,8 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "gapic/common"
20
- require "gapic/config"
21
- require "gapic/config/method"
22
-
23
19
  require "google/cloud/errors"
24
- require "google/cloud/speech/v1p1beta1/version"
25
20
  require "google/cloud/speech/v1p1beta1/cloud_speech_pb"
26
- require "google/cloud/speech/v1p1beta1/speech/credentials"
27
- require "google/cloud/speech/v1p1beta1/speech/operations"
28
21
 
29
22
  module Google
30
23
  module Cloud
@@ -37,21 +30,23 @@ module Google
37
30
  # Service that implements Google Cloud Speech API.
38
31
  #
39
32
  class Client
33
+ include Paths
34
+
40
35
  # @private
41
36
  attr_reader :speech_stub
42
37
 
43
38
  ##
44
39
  # Configure the Speech Client class.
45
40
  #
46
- # See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
41
+ # See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
47
42
  # for a description of the configuration fields.
48
43
  #
49
44
  # ## Example
50
45
  #
51
46
  # To modify the configuration for all Speech clients:
52
47
  #
53
- # Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
54
- # config.timeout = 10_000
48
+ # ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
49
+ # config.timeout = 10.0
55
50
  # end
56
51
  #
57
52
  # @yield [config] Configure the Client client.
@@ -101,7 +96,7 @@ module Google
101
96
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
102
97
  # should be made on {Client.configure}.
103
98
  #
104
- # See {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
99
+ # See {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration}
105
100
  # for a description of the configuration fields.
106
101
  #
107
102
  # @yield [config] Configure the Client client.
@@ -122,13 +117,13 @@ module Google
122
117
  # To create a new Speech client with the default
123
118
  # configuration:
124
119
  #
125
- # client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new
120
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
126
121
  #
127
122
  # To create a new Speech client with a custom
128
123
  # configuration:
129
124
  #
130
- # client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
131
- # config.timeout = 10_000
125
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
126
+ # config.timeout = 10.0
132
127
  # end
133
128
  #
134
129
  # @yield [config] Configure the Speech client.
@@ -153,14 +148,16 @@ module Google
153
148
  if credentials.is_a?(String) || credentials.is_a?(Hash)
154
149
  credentials = Credentials.new credentials, scope: @config.scope
155
150
  end
156
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
151
+ @quota_project_id = @config.quota_project
152
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
153
 
158
154
  @operations_client = Operations.new do |config|
159
155
  config.credentials = credentials
156
+ config.endpoint = @config.endpoint
160
157
  end
161
158
 
162
- @speech_stub = Gapic::ServiceStub.new(
163
- Google::Cloud::Speech::V1p1beta1::Speech::Stub,
159
+ @speech_stub = ::Gapic::ServiceStub.new(
160
+ ::Google::Cloud::Speech::V1p1beta1::Speech::Stub,
164
161
  credentials: credentials,
165
162
  endpoint: @config.endpoint,
166
163
  channel_args: @config.channel_args,
@@ -168,6 +165,13 @@ module Google
168
165
  )
169
166
  end
170
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
+
171
175
  # Service calls
172
176
 
173
177
  ##
@@ -175,41 +179,47 @@ module Google
175
179
  # has been sent and processed.
176
180
  #
177
181
  # @overload recognize(request, options = nil)
178
- # @param request [Google::Cloud::Speech::V1p1beta1::RecognizeRequest | Hash]
179
- # Performs synchronous speech recognition: receive results after all audio
180
- # has been sent and processed.
181
- # @param options [Gapic::CallOptions, Hash]
182
+ # Pass arguments to `recognize` via a request object, either of type
183
+ # {::Google::Cloud::Speech::V1p1beta1::RecognizeRequest} or an equivalent Hash.
184
+ #
185
+ # @param request [::Google::Cloud::Speech::V1p1beta1::RecognizeRequest, ::Hash]
186
+ # A request object representing the call parameters. Required. To specify no
187
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
188
+ # @param options [::Gapic::CallOptions, ::Hash]
182
189
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
183
190
  #
184
191
  # @overload recognize(config: nil, audio: nil)
185
- # @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig | Hash]
192
+ # Pass arguments to `recognize` via keyword arguments. Note that at
193
+ # least one keyword argument is required. To specify no parameters, or to keep all
194
+ # the default parameter values, pass an empty Hash as a request object (see above).
195
+ #
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
- #
192
202
  # @yield [response, operation] Access the result along with the RPC operation
193
- # @yieldparam response [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
194
- # @yieldparam operation [GRPC::ActiveCall::Operation]
203
+ # @yieldparam response [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
204
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
195
205
  #
196
- # @return [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
206
+ # @return [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
197
207
  #
198
- # @raise [Google::Cloud::Error] if the RPC is aborted.
208
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
199
209
  #
200
210
  def recognize request, options = nil
201
- raise ArgumentError, "request must be provided" if request.nil?
211
+ raise ::ArgumentError, "request must be provided" if request.nil?
202
212
 
203
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::RecognizeRequest
213
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::RecognizeRequest
204
214
 
205
215
  # Converts hash and nil to an options object
206
- 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
207
217
 
208
218
  # Customize the options with defaults
209
219
  metadata = @config.rpcs.recognize.metadata.to_h
210
220
 
211
221
  # Set x-goog-api-client and x-goog-user-project headers
212
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
222
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
213
223
  lib_name: @config.lib_name, lib_version: @config.lib_version,
214
224
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
215
225
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -224,8 +234,8 @@ module Google
224
234
  yield response, operation if block_given?
225
235
  return response
226
236
  end
227
- rescue GRPC::BadStatus => e
228
- raise Google::Cloud::Error.from_error(e)
237
+ rescue ::GRPC::BadStatus => e
238
+ raise ::Google::Cloud::Error.from_error(e)
229
239
  end
230
240
 
231
241
  ##
@@ -237,45 +247,47 @@ module Google
237
247
  # [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
238
248
  #
239
249
  # @overload long_running_recognize(request, options = nil)
240
- # @param request [Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest | Hash]
241
- # Performs asynchronous speech recognition: receive results via the
242
- # google.longrunning.Operations interface. Returns either an
243
- # `Operation.error` or an `Operation.response` which contains
244
- # a `LongRunningRecognizeResponse` message.
245
- # For more information on asynchronous speech recognition, see the
246
- # [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
247
- # @param options [Gapic::CallOptions, Hash]
250
+ # Pass arguments to `long_running_recognize` via a request object, either of type
251
+ # {::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest} or an equivalent Hash.
252
+ #
253
+ # @param request [::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest, ::Hash]
254
+ # A request object representing the call parameters. Required. To specify no
255
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
256
+ # @param options [::Gapic::CallOptions, ::Hash]
248
257
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
249
258
  #
250
259
  # @overload long_running_recognize(config: nil, audio: nil)
251
- # @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig | Hash]
260
+ # Pass arguments to `long_running_recognize` via keyword arguments. Note that at
261
+ # least one keyword argument is required. To specify no parameters, or to keep all
262
+ # the default parameter values, pass an empty Hash as a request object (see above).
263
+ #
264
+ # @param config [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig, ::Hash]
252
265
  # Required. Provides information to the recognizer that specifies how to
253
266
  # process the request.
254
- # @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio | Hash]
267
+ # @param audio [::Google::Cloud::Speech::V1p1beta1::RecognitionAudio, ::Hash]
255
268
  # Required. The audio data to be recognized.
256
269
  #
257
- #
258
270
  # @yield [response, operation] Access the result along with the RPC operation
259
- # @yieldparam response [Gapic::Operation]
260
- # @yieldparam operation [GRPC::ActiveCall::Operation]
271
+ # @yieldparam response [::Gapic::Operation]
272
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
261
273
  #
262
- # @return [Gapic::Operation]
274
+ # @return [::Gapic::Operation]
263
275
  #
264
- # @raise [Google::Cloud::Error] if the RPC is aborted.
276
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
265
277
  #
266
278
  def long_running_recognize request, options = nil
267
- raise ArgumentError, "request must be provided" if request.nil?
279
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
280
 
269
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
281
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest
270
282
 
271
283
  # Converts hash and nil to an options object
272
- 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
273
285
 
274
286
  # Customize the options with defaults
275
287
  metadata = @config.rpcs.long_running_recognize.metadata.to_h
276
288
 
277
289
  # Set x-goog-api-client and x-goog-user-project headers
278
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
290
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
291
  lib_name: @config.lib_name, lib_version: @config.lib_version,
280
292
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
281
293
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -287,49 +299,49 @@ module Google
287
299
  retry_policy: @config.retry_policy
288
300
 
289
301
  @speech_stub.call_rpc :long_running_recognize, request, options: options do |response, operation|
290
- response = Gapic::Operation.new response, @operations_client, options: options
302
+ response = ::Gapic::Operation.new response, @operations_client, options: options
291
303
  yield response, operation if block_given?
292
304
  return response
293
305
  end
294
- rescue GRPC::BadStatus => e
295
- raise Google::Cloud::Error.from_error(e)
306
+ rescue ::GRPC::BadStatus => e
307
+ raise ::Google::Cloud::Error.from_error(e)
296
308
  end
297
309
 
298
310
  ##
299
311
  # Performs bidirectional streaming speech recognition: receive results while
300
312
  # sending audio. This method is only available via the gRPC API (not REST).
301
313
  #
302
- # @param request [Gapic::StreamInput, Enumerable<Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest | Hash>]
303
- # An enumerable of {Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest} instances.
304
- # @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]
305
317
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
306
318
  #
307
319
  # @yield [response, operation] Access the result along with the RPC operation
308
- # @yieldparam response [Enumerable<Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
309
- # @yieldparam operation [GRPC::ActiveCall::Operation]
320
+ # @yieldparam response [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
321
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
310
322
  #
311
- # @return [Enumerable<Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
323
+ # @return [::Enumerable<::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse>]
312
324
  #
313
- # @raise [Google::Cloud::Error] if the RPC is aborted.
325
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
314
326
  #
315
327
  def streaming_recognize request, options = nil
316
- unless request.is_a? Enumerable
317
- 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
318
330
  request = request.to_enum
319
331
  end
320
332
 
321
333
  request = request.lazy.map do |req|
322
- Gapic::Protobuf.coerce req, to: Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
334
+ ::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
323
335
  end
324
336
 
325
337
  # Converts hash and nil to an options object
326
- 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
327
339
 
328
340
  # Customize the options with defaults
329
341
  metadata = @config.rpcs.streaming_recognize.metadata.to_h
330
342
 
331
343
  # Set x-goog-api-client and x-goog-user-project headers
332
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
344
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
333
345
  lib_name: @config.lib_name, lib_version: @config.lib_version,
334
346
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
335
347
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -344,8 +356,8 @@ module Google
344
356
  yield response, operation if block_given?
345
357
  return response
346
358
  end
347
- rescue GRPC::BadStatus => e
348
- raise Google::Cloud::Error.from_error(e)
359
+ rescue ::GRPC::BadStatus => e
360
+ raise ::Google::Cloud::Error.from_error(e)
349
361
  end
350
362
 
351
363
  ##
@@ -355,7 +367,7 @@ module Google
355
367
  # providing control over timeouts, retry behavior, logging, transport
356
368
  # parameters, and other low-level controls. Certain parameters can also be
357
369
  # applied individually to specific RPCs. See
358
- # {Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
370
+ # {::Google::Cloud::Speech::V1p1beta1::Speech::Client::Configuration::Rpcs}
359
371
  # for a list of RPCs that can be configured independently.
360
372
  #
361
373
  # Configuration can be applied globally to all clients, or to a single client
@@ -366,22 +378,22 @@ module Google
366
378
  # To modify the global config, setting the timeout for recognize
367
379
  # to 20 seconds, and all remaining timeouts to 10 seconds:
368
380
  #
369
- # Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
370
- # config.timeout = 10_000
371
- # config.rpcs.recognize.timeout = 20_000
381
+ # ::Google::Cloud::Speech::V1p1beta1::Speech::Client.configure do |config|
382
+ # config.timeout = 10.0
383
+ # config.rpcs.recognize.timeout = 20.0
372
384
  # end
373
385
  #
374
386
  # To apply the above configuration only to a new client:
375
387
  #
376
- # client = Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
377
- # config.timeout = 10_000
378
- # config.rpcs.recognize.timeout = 20_000
388
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new do |config|
389
+ # config.timeout = 10.0
390
+ # config.rpcs.recognize.timeout = 20.0
379
391
  # end
380
392
  #
381
393
  # @!attribute [rw] endpoint
382
394
  # The hostname or hostname:port of the service endpoint.
383
395
  # Defaults to `"speech.googleapis.com"`.
384
- # @return [String]
396
+ # @return [::String]
385
397
  # @!attribute [rw] credentials
386
398
  # Credentials to send with calls. You may provide any of the following types:
387
399
  # * (`String`) The path to a service account key file in JSON format
@@ -393,29 +405,29 @@ module Google
393
405
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
394
406
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
395
407
  # * (`nil`) indicating no credentials
396
- # @return [Object]
408
+ # @return [::Object]
397
409
  # @!attribute [rw] scope
398
410
  # The OAuth scopes
399
- # @return [Array<String>]
411
+ # @return [::Array<::String>]
400
412
  # @!attribute [rw] lib_name
401
413
  # The library name as recorded in instrumentation and logging
402
- # @return [String]
414
+ # @return [::String]
403
415
  # @!attribute [rw] lib_version
404
416
  # The library version as recorded in instrumentation and logging
405
- # @return [String]
417
+ # @return [::String]
406
418
  # @!attribute [rw] channel_args
407
419
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
408
420
  # `GRPC::Core::Channel` object is provided as the credential.
409
- # @return [Hash]
421
+ # @return [::Hash]
410
422
  # @!attribute [rw] interceptors
411
423
  # An array of interceptors that are run before calls are executed.
412
- # @return [Array<GRPC::ClientInterceptor>]
424
+ # @return [::Array<::GRPC::ClientInterceptor>]
413
425
  # @!attribute [rw] timeout
414
- # The call timeout in milliseconds.
415
- # @return [Numeric]
426
+ # The call timeout in seconds.
427
+ # @return [::Numeric]
416
428
  # @!attribute [rw] metadata
417
429
  # Additional gRPC headers to be sent with the call.
418
- # @return [Hash{Symbol=>String}]
430
+ # @return [::Hash{::Symbol=>::String}]
419
431
  # @!attribute [rw] retry_policy
420
432
  # The retry policy. The value is a hash with the following keys:
421
433
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -423,25 +435,29 @@ module Google
423
435
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
424
436
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
425
437
  # trigger a retry.
426
- # @return [Hash]
438
+ # @return [::Hash]
439
+ # @!attribute [rw] quota_project
440
+ # A separate project against which to charge quota.
441
+ # @return [::String]
427
442
  #
428
443
  class Configuration
429
- extend Gapic::Config
444
+ extend ::Gapic::Config
430
445
 
431
- config_attr :endpoint, "speech.googleapis.com", String
432
- config_attr :credentials, nil do |value|
446
+ config_attr :endpoint, "speech.googleapis.com", ::String
447
+ config_attr :credentials, nil do |value|
433
448
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
434
449
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
435
450
  allowed.any? { |klass| klass === value }
436
451
  end
437
- config_attr :scope, nil, String, Array, nil
438
- config_attr :lib_name, nil, String, nil
439
- config_attr :lib_version, nil, String, nil
440
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
441
- config_attr :interceptors, nil, Array, nil
442
- config_attr :timeout, nil, Numeric, nil
443
- config_attr :metadata, nil, Hash, nil
444
- config_attr :retry_policy, nil, Hash, Proc, nil
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
445
461
 
446
462
  # @private
447
463
  def initialize parent_config = nil
@@ -482,28 +498,28 @@ module Google
482
498
  class Rpcs
483
499
  ##
484
500
  # RPC-specific configuration for `recognize`
485
- # @return [Gapic::Config::Method]
501
+ # @return [::Gapic::Config::Method]
486
502
  #
487
503
  attr_reader :recognize
488
504
  ##
489
505
  # RPC-specific configuration for `long_running_recognize`
490
- # @return [Gapic::Config::Method]
506
+ # @return [::Gapic::Config::Method]
491
507
  #
492
508
  attr_reader :long_running_recognize
493
509
  ##
494
510
  # RPC-specific configuration for `streaming_recognize`
495
- # @return [Gapic::Config::Method]
511
+ # @return [::Gapic::Config::Method]
496
512
  #
497
513
  attr_reader :streaming_recognize
498
514
 
499
515
  # @private
500
516
  def initialize parent_rpcs = nil
501
517
  recognize_config = parent_rpcs&.recognize if parent_rpcs&.respond_to? :recognize
502
- @recognize = Gapic::Config::Method.new recognize_config
518
+ @recognize = ::Gapic::Config::Method.new recognize_config
503
519
  long_running_recognize_config = parent_rpcs&.long_running_recognize if parent_rpcs&.respond_to? :long_running_recognize
504
- @long_running_recognize = Gapic::Config::Method.new long_running_recognize_config
520
+ @long_running_recognize = ::Gapic::Config::Method.new long_running_recognize_config
505
521
  streaming_recognize_config = parent_rpcs&.streaming_recognize if parent_rpcs&.respond_to? :streaming_recognize
506
- @streaming_recognize = Gapic::Config::Method.new streaming_recognize_config
522
+ @streaming_recognize = ::Gapic::Config::Method.new streaming_recognize_config
507
523
 
508
524
  yield self if block_given?
509
525
  end
@@ -515,13 +531,3 @@ module Google
515
531
  end
516
532
  end
517
533
  end
518
-
519
- # rubocop:disable Lint/HandleExceptions
520
-
521
- # Once client is loaded, load helpers.rb if it exists.
522
- begin
523
- require "google/cloud/speech/v1p1beta1/speech/helpers"
524
- rescue LoadError
525
- end
526
-
527
- # rubocop:enable Lint/HandleExceptions