google-apis-speech_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module SpeechV1
18
+ # Version of the google-apis-speech_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200824"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,289 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module SpeechV1
24
+
25
+ class ListOperationsResponse
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class LongRunningRecognizeMetadata
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class LongRunningRecognizeRequest
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class LongRunningRecognizeResponse
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Operation
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class RecognitionAudio
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class RecognitionConfig
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class RecognitionMetadata
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class RecognizeRequest
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class RecognizeResponse
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class SpeakerDiarizationConfig
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class SpeechContext
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class SpeechRecognitionAlternative
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class SpeechRecognitionResult
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class Status
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class WordInfo
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class ListOperationsResponse
122
+ # @private
123
+ class Representation < Google::Apis::Core::JsonRepresentation
124
+ property :next_page_token, as: 'nextPageToken'
125
+ collection :operations, as: 'operations', class: Google::Apis::SpeechV1::Operation, decorator: Google::Apis::SpeechV1::Operation::Representation
126
+
127
+ end
128
+ end
129
+
130
+ class LongRunningRecognizeMetadata
131
+ # @private
132
+ class Representation < Google::Apis::Core::JsonRepresentation
133
+ property :last_update_time, as: 'lastUpdateTime'
134
+ property :progress_percent, as: 'progressPercent'
135
+ property :start_time, as: 'startTime'
136
+ property :uri, as: 'uri'
137
+ end
138
+ end
139
+
140
+ class LongRunningRecognizeRequest
141
+ # @private
142
+ class Representation < Google::Apis::Core::JsonRepresentation
143
+ property :audio, as: 'audio', class: Google::Apis::SpeechV1::RecognitionAudio, decorator: Google::Apis::SpeechV1::RecognitionAudio::Representation
144
+
145
+ property :config, as: 'config', class: Google::Apis::SpeechV1::RecognitionConfig, decorator: Google::Apis::SpeechV1::RecognitionConfig::Representation
146
+
147
+ end
148
+ end
149
+
150
+ class LongRunningRecognizeResponse
151
+ # @private
152
+ class Representation < Google::Apis::Core::JsonRepresentation
153
+ collection :results, as: 'results', class: Google::Apis::SpeechV1::SpeechRecognitionResult, decorator: Google::Apis::SpeechV1::SpeechRecognitionResult::Representation
154
+
155
+ end
156
+ end
157
+
158
+ class Operation
159
+ # @private
160
+ class Representation < Google::Apis::Core::JsonRepresentation
161
+ property :done, as: 'done'
162
+ property :error, as: 'error', class: Google::Apis::SpeechV1::Status, decorator: Google::Apis::SpeechV1::Status::Representation
163
+
164
+ hash :metadata, as: 'metadata'
165
+ property :name, as: 'name'
166
+ hash :response, as: 'response'
167
+ end
168
+ end
169
+
170
+ class RecognitionAudio
171
+ # @private
172
+ class Representation < Google::Apis::Core::JsonRepresentation
173
+ property :content, :base64 => true, as: 'content'
174
+ property :uri, as: 'uri'
175
+ end
176
+ end
177
+
178
+ class RecognitionConfig
179
+ # @private
180
+ class Representation < Google::Apis::Core::JsonRepresentation
181
+ property :audio_channel_count, as: 'audioChannelCount'
182
+ property :diarization_config, as: 'diarizationConfig', class: Google::Apis::SpeechV1::SpeakerDiarizationConfig, decorator: Google::Apis::SpeechV1::SpeakerDiarizationConfig::Representation
183
+
184
+ property :enable_automatic_punctuation, as: 'enableAutomaticPunctuation'
185
+ property :enable_separate_recognition_per_channel, as: 'enableSeparateRecognitionPerChannel'
186
+ property :enable_word_time_offsets, as: 'enableWordTimeOffsets'
187
+ property :encoding, as: 'encoding'
188
+ property :language_code, as: 'languageCode'
189
+ property :max_alternatives, as: 'maxAlternatives'
190
+ property :metadata, as: 'metadata', class: Google::Apis::SpeechV1::RecognitionMetadata, decorator: Google::Apis::SpeechV1::RecognitionMetadata::Representation
191
+
192
+ property :model, as: 'model'
193
+ property :profanity_filter, as: 'profanityFilter'
194
+ property :sample_rate_hertz, as: 'sampleRateHertz'
195
+ collection :speech_contexts, as: 'speechContexts', class: Google::Apis::SpeechV1::SpeechContext, decorator: Google::Apis::SpeechV1::SpeechContext::Representation
196
+
197
+ property :use_enhanced, as: 'useEnhanced'
198
+ end
199
+ end
200
+
201
+ class RecognitionMetadata
202
+ # @private
203
+ class Representation < Google::Apis::Core::JsonRepresentation
204
+ property :audio_topic, as: 'audioTopic'
205
+ property :industry_naics_code_of_audio, as: 'industryNaicsCodeOfAudio'
206
+ property :interaction_type, as: 'interactionType'
207
+ property :microphone_distance, as: 'microphoneDistance'
208
+ property :original_media_type, as: 'originalMediaType'
209
+ property :original_mime_type, as: 'originalMimeType'
210
+ property :recording_device_name, as: 'recordingDeviceName'
211
+ property :recording_device_type, as: 'recordingDeviceType'
212
+ end
213
+ end
214
+
215
+ class RecognizeRequest
216
+ # @private
217
+ class Representation < Google::Apis::Core::JsonRepresentation
218
+ property :audio, as: 'audio', class: Google::Apis::SpeechV1::RecognitionAudio, decorator: Google::Apis::SpeechV1::RecognitionAudio::Representation
219
+
220
+ property :config, as: 'config', class: Google::Apis::SpeechV1::RecognitionConfig, decorator: Google::Apis::SpeechV1::RecognitionConfig::Representation
221
+
222
+ end
223
+ end
224
+
225
+ class RecognizeResponse
226
+ # @private
227
+ class Representation < Google::Apis::Core::JsonRepresentation
228
+ collection :results, as: 'results', class: Google::Apis::SpeechV1::SpeechRecognitionResult, decorator: Google::Apis::SpeechV1::SpeechRecognitionResult::Representation
229
+
230
+ end
231
+ end
232
+
233
+ class SpeakerDiarizationConfig
234
+ # @private
235
+ class Representation < Google::Apis::Core::JsonRepresentation
236
+ property :enable_speaker_diarization, as: 'enableSpeakerDiarization'
237
+ property :max_speaker_count, as: 'maxSpeakerCount'
238
+ property :min_speaker_count, as: 'minSpeakerCount'
239
+ property :speaker_tag, as: 'speakerTag'
240
+ end
241
+ end
242
+
243
+ class SpeechContext
244
+ # @private
245
+ class Representation < Google::Apis::Core::JsonRepresentation
246
+ collection :phrases, as: 'phrases'
247
+ end
248
+ end
249
+
250
+ class SpeechRecognitionAlternative
251
+ # @private
252
+ class Representation < Google::Apis::Core::JsonRepresentation
253
+ property :confidence, as: 'confidence'
254
+ property :transcript, as: 'transcript'
255
+ collection :words, as: 'words', class: Google::Apis::SpeechV1::WordInfo, decorator: Google::Apis::SpeechV1::WordInfo::Representation
256
+
257
+ end
258
+ end
259
+
260
+ class SpeechRecognitionResult
261
+ # @private
262
+ class Representation < Google::Apis::Core::JsonRepresentation
263
+ collection :alternatives, as: 'alternatives', class: Google::Apis::SpeechV1::SpeechRecognitionAlternative, decorator: Google::Apis::SpeechV1::SpeechRecognitionAlternative::Representation
264
+
265
+ property :channel_tag, as: 'channelTag'
266
+ end
267
+ end
268
+
269
+ class Status
270
+ # @private
271
+ class Representation < Google::Apis::Core::JsonRepresentation
272
+ property :code, as: 'code'
273
+ collection :details, as: 'details'
274
+ property :message, as: 'message'
275
+ end
276
+ end
277
+
278
+ class WordInfo
279
+ # @private
280
+ class Representation < Google::Apis::Core::JsonRepresentation
281
+ property :end_time, as: 'endTime'
282
+ property :speaker_tag, as: 'speakerTag'
283
+ property :start_time, as: 'startTime'
284
+ property :word, as: 'word'
285
+ end
286
+ end
287
+ end
288
+ end
289
+ end
@@ -0,0 +1,280 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module SpeechV1
23
+ # Cloud Speech-to-Text API
24
+ #
25
+ # Converts audio to text by applying powerful neural network models.
26
+ #
27
+ # @example
28
+ # require 'google/apis/speech_v1'
29
+ #
30
+ # Speech = Google::Apis::SpeechV1 # Alias the module
31
+ # service = Speech::SpeechService.new
32
+ #
33
+ # @see https://cloud.google.com/speech-to-text/docs/quickstart-protocol
34
+ class SpeechService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://speech.googleapis.com/', '',
47
+ client_name: 'google-apis-speech_v1',
48
+ client_version: Google::Apis::SpeechV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Gets the latest state of a long-running operation. Clients can use this method
53
+ # to poll the operation result at intervals as recommended by the API service.
54
+ # @param [String] name
55
+ # The name of the operation resource.
56
+ # @param [String] fields
57
+ # Selector specifying which fields to include in a partial response.
58
+ # @param [String] quota_user
59
+ # Available to use for quota purposes for server-side applications. Can be any
60
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
61
+ # @param [Google::Apis::RequestOptions] options
62
+ # Request-specific options
63
+ #
64
+ # @yield [result, err] Result & error if block supplied
65
+ # @yieldparam result [Google::Apis::SpeechV1::Operation] parsed result object
66
+ # @yieldparam err [StandardError] error object if request failed
67
+ #
68
+ # @return [Google::Apis::SpeechV1::Operation]
69
+ #
70
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
71
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
72
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
73
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
74
+ command = make_simple_command(:get, 'v1/operations/{+name}', options)
75
+ command.response_representation = Google::Apis::SpeechV1::Operation::Representation
76
+ command.response_class = Google::Apis::SpeechV1::Operation
77
+ command.params['name'] = name unless name.nil?
78
+ command.query['fields'] = fields unless fields.nil?
79
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
80
+ execute_or_queue_command(command, &block)
81
+ end
82
+
83
+ # Lists operations that match the specified filter in the request. If the server
84
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
85
+ # binding allows API services to override the binding to use different resource
86
+ # name schemes, such as `users/*/operations`. To override the binding, API
87
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
88
+ # service configuration. For backwards compatibility, the default name includes
89
+ # the operations collection id, however overriding users must ensure the name
90
+ # binding is the parent resource, without the operations collection id.
91
+ # @param [String] filter
92
+ # The standard list filter.
93
+ # @param [String] name
94
+ # The name of the operation's parent resource.
95
+ # @param [Fixnum] page_size
96
+ # The standard list page size.
97
+ # @param [String] page_token
98
+ # The standard list page token.
99
+ # @param [String] fields
100
+ # Selector specifying which fields to include in a partial response.
101
+ # @param [String] quota_user
102
+ # Available to use for quota purposes for server-side applications. Can be any
103
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
104
+ # @param [Google::Apis::RequestOptions] options
105
+ # Request-specific options
106
+ #
107
+ # @yield [result, err] Result & error if block supplied
108
+ # @yieldparam result [Google::Apis::SpeechV1::ListOperationsResponse] parsed result object
109
+ # @yieldparam err [StandardError] error object if request failed
110
+ #
111
+ # @return [Google::Apis::SpeechV1::ListOperationsResponse]
112
+ #
113
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
114
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
115
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
116
+ def list_operations(filter: nil, name: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
117
+ command = make_simple_command(:get, 'v1/operations', options)
118
+ command.response_representation = Google::Apis::SpeechV1::ListOperationsResponse::Representation
119
+ command.response_class = Google::Apis::SpeechV1::ListOperationsResponse
120
+ command.query['filter'] = filter unless filter.nil?
121
+ command.query['name'] = name unless name.nil?
122
+ command.query['pageSize'] = page_size unless page_size.nil?
123
+ command.query['pageToken'] = page_token unless page_token.nil?
124
+ command.query['fields'] = fields unless fields.nil?
125
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
126
+ execute_or_queue_command(command, &block)
127
+ end
128
+
129
+ # Gets the latest state of a long-running operation. Clients can use this method
130
+ # to poll the operation result at intervals as recommended by the API service.
131
+ # @param [String] name
132
+ # The name of the operation resource.
133
+ # @param [String] fields
134
+ # Selector specifying which fields to include in a partial response.
135
+ # @param [String] quota_user
136
+ # Available to use for quota purposes for server-side applications. Can be any
137
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
138
+ # @param [Google::Apis::RequestOptions] options
139
+ # Request-specific options
140
+ #
141
+ # @yield [result, err] Result & error if block supplied
142
+ # @yieldparam result [Google::Apis::SpeechV1::Operation] parsed result object
143
+ # @yieldparam err [StandardError] error object if request failed
144
+ #
145
+ # @return [Google::Apis::SpeechV1::Operation]
146
+ #
147
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
148
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
149
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
150
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
151
+ command = make_simple_command(:get, 'v1/{+name}', options)
152
+ command.response_representation = Google::Apis::SpeechV1::Operation::Representation
153
+ command.response_class = Google::Apis::SpeechV1::Operation
154
+ command.params['name'] = name unless name.nil?
155
+ command.query['fields'] = fields unless fields.nil?
156
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
157
+ execute_or_queue_command(command, &block)
158
+ end
159
+
160
+ # Lists operations that match the specified filter in the request. If the server
161
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
162
+ # binding allows API services to override the binding to use different resource
163
+ # name schemes, such as `users/*/operations`. To override the binding, API
164
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
165
+ # service configuration. For backwards compatibility, the default name includes
166
+ # the operations collection id, however overriding users must ensure the name
167
+ # binding is the parent resource, without the operations collection id.
168
+ # @param [String] name
169
+ # The name of the operation's parent resource.
170
+ # @param [String] filter
171
+ # The standard list filter.
172
+ # @param [Fixnum] page_size
173
+ # The standard list page size.
174
+ # @param [String] page_token
175
+ # The standard list page token.
176
+ # @param [String] fields
177
+ # Selector specifying which fields to include in a partial response.
178
+ # @param [String] quota_user
179
+ # Available to use for quota purposes for server-side applications. Can be any
180
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
181
+ # @param [Google::Apis::RequestOptions] options
182
+ # Request-specific options
183
+ #
184
+ # @yield [result, err] Result & error if block supplied
185
+ # @yieldparam result [Google::Apis::SpeechV1::ListOperationsResponse] parsed result object
186
+ # @yieldparam err [StandardError] error object if request failed
187
+ #
188
+ # @return [Google::Apis::SpeechV1::ListOperationsResponse]
189
+ #
190
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
191
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
192
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
193
+ def list_project_location_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
194
+ command = make_simple_command(:get, 'v1/{+name}/operations', options)
195
+ command.response_representation = Google::Apis::SpeechV1::ListOperationsResponse::Representation
196
+ command.response_class = Google::Apis::SpeechV1::ListOperationsResponse
197
+ command.params['name'] = name unless name.nil?
198
+ command.query['filter'] = filter unless filter.nil?
199
+ command.query['pageSize'] = page_size unless page_size.nil?
200
+ command.query['pageToken'] = page_token unless page_token.nil?
201
+ command.query['fields'] = fields unless fields.nil?
202
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
203
+ execute_or_queue_command(command, &block)
204
+ end
205
+
206
+ # Performs asynchronous speech recognition: receive results via the google.
207
+ # longrunning.Operations interface. Returns either an `Operation.error` or an `
208
+ # Operation.response` which contains a `LongRunningRecognizeResponse` message.
209
+ # For more information on asynchronous speech recognition, see the [how-to](
210
+ # https://cloud.google.com/speech-to-text/docs/async-recognize).
211
+ # @param [Google::Apis::SpeechV1::LongRunningRecognizeRequest] long_running_recognize_request_object
212
+ # @param [String] fields
213
+ # Selector specifying which fields to include in a partial response.
214
+ # @param [String] quota_user
215
+ # Available to use for quota purposes for server-side applications. Can be any
216
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
217
+ # @param [Google::Apis::RequestOptions] options
218
+ # Request-specific options
219
+ #
220
+ # @yield [result, err] Result & error if block supplied
221
+ # @yieldparam result [Google::Apis::SpeechV1::Operation] parsed result object
222
+ # @yieldparam err [StandardError] error object if request failed
223
+ #
224
+ # @return [Google::Apis::SpeechV1::Operation]
225
+ #
226
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
227
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
228
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
229
+ def longrunningrecognize_speech(long_running_recognize_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
230
+ command = make_simple_command(:post, 'v1/speech:longrunningrecognize', options)
231
+ command.request_representation = Google::Apis::SpeechV1::LongRunningRecognizeRequest::Representation
232
+ command.request_object = long_running_recognize_request_object
233
+ command.response_representation = Google::Apis::SpeechV1::Operation::Representation
234
+ command.response_class = Google::Apis::SpeechV1::Operation
235
+ command.query['fields'] = fields unless fields.nil?
236
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
237
+ execute_or_queue_command(command, &block)
238
+ end
239
+
240
+ # Performs synchronous speech recognition: receive results after all audio has
241
+ # been sent and processed.
242
+ # @param [Google::Apis::SpeechV1::RecognizeRequest] recognize_request_object
243
+ # @param [String] fields
244
+ # Selector specifying which fields to include in a partial response.
245
+ # @param [String] quota_user
246
+ # Available to use for quota purposes for server-side applications. Can be any
247
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
248
+ # @param [Google::Apis::RequestOptions] options
249
+ # Request-specific options
250
+ #
251
+ # @yield [result, err] Result & error if block supplied
252
+ # @yieldparam result [Google::Apis::SpeechV1::RecognizeResponse] parsed result object
253
+ # @yieldparam err [StandardError] error object if request failed
254
+ #
255
+ # @return [Google::Apis::SpeechV1::RecognizeResponse]
256
+ #
257
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
258
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
259
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
260
+ def recognize_speech(recognize_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
261
+ command = make_simple_command(:post, 'v1/speech:recognize', options)
262
+ command.request_representation = Google::Apis::SpeechV1::RecognizeRequest::Representation
263
+ command.request_object = recognize_request_object
264
+ command.response_representation = Google::Apis::SpeechV1::RecognizeResponse::Representation
265
+ command.response_class = Google::Apis::SpeechV1::RecognizeResponse
266
+ command.query['fields'] = fields unless fields.nil?
267
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
268
+ execute_or_queue_command(command, &block)
269
+ end
270
+
271
+ protected
272
+
273
+ def apply_command_defaults(command)
274
+ command.query['key'] = key unless key.nil?
275
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
276
+ end
277
+ end
278
+ end
279
+ end
280
+ end